Atlassian Confluence : Updating parent container of an attachment -
i'd move attachment different space (i.e, update parent container of attachment in confluence page) using cloud rest api , "curl" command. looked rest api endpoint url , found this:
put /rest/api/content/{id}/child/attachment/{attachmentid} could provide example correctly constructed json input achieve this? tried 1 below move attachment called "test.jpeg" id "att000" , current version 5 parent id 1234, fails:
curl -v -u 'admin:password' -x put -h 'content-type:application/json' -d '{"id":"att000","type":"attachment","title":"test.jpeg","version":{"number":5,"minoredit":false},"ancestors":[{"id":1234}]' -h ‘x-atlassian-token:access-token' https://test.atlassian.net/wiki/rest/api/content/170234/child/attachment | python -m json.tool given below error message
< http/1.1 415 unsupported media type . . . no json object decoded thank time!
i believe in curl example uploading under space not possible. attachments in confluence needs under content. take @ following example:
curl -v -s -u admin:admin -x post -h "x-atlassian-token: no-check" -f "file=@myfile.txt" -f "comment=this file" "http://localhost:8080/confluence/rest/api/content/3604482/child/attachment" | python -mjson.tool
Comments
Post a Comment