Why am I getting a 405 from this request?

From the linux/mac command line (bash):

curl -D- -u myUsername:myPassword -X PUT --data '{"update":{"labels":[{"add":"testlabel2"}]}}' -H "Content-Type: application/json" https://mycompany.jira.com/rest/api/latest/issue/CRE-97/editmeta

Using cloud-based jira, which reports to be version 7.0.0.  I'm new to using the API; I can do this operation flawlessly if I use the interface, so I know my account is setup correctly from a permission perspective.

I get:

HTTP/1.1 405 Method Not Allowed
Server: nginx
Date: Mon, 26 Oct 2015 22:06:26 GMT
Content-Type: text/html;charset=utf-8
Content-Length: 1056
Connection: keep-alive
X-AREQUESTID: 1086x8384x1
X-ASEN: SEN-2452839
Set-Cookie: JSESSIONID=A689FB2882891B0186DFD591CED47FED; Path=/; Secure; HttpOnly
Set-Cookie: studio.crowd.tokenkey=""; Domain=.mycompany.jira.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly
X-Seraph-LoginReason: OUT
Set-Cookie: studio.crowd.tokenkey=hx9RCkR0jbCsMyOB5muQYw00; Domain=.mycompany.jira.com; Path=/; Secure; HttpOnly
X-Seraph-LoginReason: OK
Set-Cookie: atlassian.xsrf.token=AG87-S37R-QM8W-6VWE|2600c6fd212118a9db13c77376f47a6459e39193|lin; Path=/; Secure
X-ASESSIONID: 12byeuf
X-AUSERNAME: myUsername
X-ATENANT-ID: mycompany.jira.com
Allow: HEAD,GET,OPTIONS
X-Content-Type-Options: nosniff
Content-Language: en

What am I doing wrong?

1 answer

According to the examples here:

https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-edit-issues

the path in your URL is wrong

The complete curl line that should work is:

curl -D- -u myUsername:myPassword -X PUT --data '{"update":{"labels":[{"add":"testlabel2"}]}}' -H "Content-Type: application/json" https://mycompany.jira.com/rest/api/latest/issue/CRE-97

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published yesterday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

65 views 0 4
Read article

Atlassian User Groups

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!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you