0
votes

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
are you using the SBT? or raw connections API? it seems raw api. can you share the log of the request? - Paul Bastide
Request Headers : Accept text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Accept-Encoding gzip, deflate Accept-Language en-US,en;q=0.5 Content-Length 1312752 Content-Type image/jpeg; charset=UTF-8 Cookie JSESSIONID=0000OWZ06ft8gp9guJ9MpmGs4fY:-1 Host localhost:9443 Referer localhost:9443/SampleSBT/PublishedWiki.html User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0 X-Requested-With XMLHttpRequest X-Update-Nonce 01c5e775-d5a0-462e-9fa5-3d4649090b26 slug sri.jpeg - Medoju Srinivas
var file = document.getElementById("wFile").files[0]; var reader = new FileReader(); reader.onload = function(e) { //passed reader.result in request } reader.readAsBinaryString(file); - Medoju Srinivas

1 Answers

0
votes

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"