I want to use api uploading files,but faild.
I use the command
curl -D- -u $USERNAME:$PASSWORD -H "Content-Type: multipart/form-data" -F "file=@$1" -F "minorEdit=false" https://test.atlassian.net/wiki/rest/api/content/contentID/child/attachment
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0HTTP/2 401 server: nginx date: Thu, 08 Jun 2017 01:47:51 GMT content-type: text/html;charset=utf-8 content-length: 1263 www-authenticate: OAuth realm="https%3A%2F%2Feastek-ezcam.atlassian.net%2Fwiki" content-language: en 100 48906 100 1263 100 47643 1154 43549 0:00:01 0:00:01 --:--:-- 44195
Can someone help me?
I have been doing some work recently with the Jira and Confluence API's and I think I can shed some light on whats going on here.
Looking at your curl command it could do with a couple of tweaks to get it working, namely changing of the header being set and the inclusion of a '-X' argument to specify this is a PUT command.
I took the liberty of re-writing this and testing to ensure it works:
curl -D- \
-u $USERNAME:$PASSWORD \
-X PUT \
-H "X-Atlassian-Token: nocheck" \
-F "file=@$1" \
-F "minorEdit=false" \
The things to note that I have changed:
One last thing, I assume the 'contentID' portion of your command is being passed from the script you are working on? If this is indeed the case please ensure the value being passed is numerical.
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG