Hello.
I've trying to upload an attachment to a page with id 857705024 using the rest api, but I keep receiving a 301.
Can anyone help me? :-)
Here is the command:
curl -D- -u user:api_key -X POST -H "X-Atlassian-Token: nocheck" -F "file=@image.png" -F "comment=myImage" http://my-host.atlassian.net/rest/api/content/857705024/child/attachment
TIA
Paula
HTTP Response Code 301 implies "Moved Permanently"
So in order to follow this redirection we need to pass `-L` flag to curl request. So updated command will look like.
curl -L -D- -u user:api_key -X POST -H "X-Atlassian-Token: nocheck" -F "file=@image.png" -F "comment=myImage" http://my-host.atlassian.net/rest/api/content/857705024/child/attachment
Thanks.
Now I get a 404, but the number of the page is correct.
Oh! I noticed,
In place of POST, you need use PUT method for this api.
curl -L -D- -u user:api_key -X PUT -H "X-Atlassian-Token: nocheck" -F "file=@image.png" -F "comment=myImage" http://my-host.atlassian.net/rest/api/content/857705024/child/attachment
Hi DPK J.
Thanks for your help, but with POST or PUT the result is the same: a 404.
I even tried with a text file, but the result is always the same.
I don't seem to be able to upload attachments to our confluence. :-(
@DPKJ I am trying to upload an image file to issue using vbscript but no luck.
It looks like you're new here. Sign in or register to get started.