Hello, I'm trying to create an attachment on a page from a URL to an image,
using JavaScript and the RESTful API. 

I'm not sure I'm doing it correctly of if this can be done but here's where
I'm at:

httpRequest.open('PUT', '/xwiki/rest/wikis/XWiki/spaces/Main/pages/Daily
All-Source Digest – 2013-01-05T07:30P24/attachments/Blade Header
UnClassified-S.png');

httpRequest.setRequestHeader('Content-Type', 'application/xml');

httpRequest.send('<?xml version="1.0" encoding="UTF-8"
standalone="yes"?><attachment xmlns="http://www.xwiki.org";><name>"Blade
Header
UnClassified-S.png"</name><mimeType>"image/png"</mimeType><xwikiAbsoluteUrl>"https://domain/xwiki/bin/download/ColorThemes/Nightfall/Blade%20Header%20UnClassified-S.png";</xwikiAbsoluteUrl></attachment>');

This example is actually using a URL to a preexisting Attachment, just
seeing if I'm getting permission errors on the server some how. I've also
tried random publicly accessible images.

I get a 200 response signaling an attachment is created and a link appears
on the page in the attachment section but the image won't display because
'it contains errors'.

Can I submit attachments this way? Do I need the actual image data, encoded
somehow?



--
View this message in context: 
http://xwiki.475771.n2.nabble.com/create-attachment-with-Rest-API-tp7583867.html
Sent from the XWiki- Dev mailing list archive at Nabble.com.
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to