Adding an image attachment to a wiki page programmatically using RestAPI through javascript

211 Views Asked by At

I tried attaching an image as attachment to existing wiki page using RestAPI.

Followed this link http://www-10.lotus.com/ldd/appdevwiki.nsf/xpAPIViewer.xsp?lookupName=API+Reference#action=openDocument&res_title=Adding_an_attachment_to_a_wiki_page&content=apicontent

I am able to create the attachment to the wiki but it is getting corrupted when opened.Am i doing any thing wrong i sent SLug header as test.png and nonce as 1aae1966-9baf-416b-bb4c-24fe6ca7c298 and content as some binary data

Any sample examples to attach an image as attachment in WIKI page.

Thanks in advance

1

There are 1 best solutions below

2
Paul Bastide On

here is a curl command showing how to add attachment

curl -u "<EMAIL>:<PASSWORD>" -X POST -H "X-Update-Nonce: <NONCE>" -H "Content-Type: <CONTENT_TYPE>" -H "Slug: <FILENAME>" --data "@<FILE>" "https://<SERVER>/wikis/basic/api/wiki/<WIKI>/page/<WIKIPAGE>/feed?category=attachment"