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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Trello

Alice Camilla on organizing your work/life/fandoms with Trello!

@Alice Camilla is a university student, currently writing her MA thesis in Archaeology. She's also a freelance blogger and content creator, writing about geeky stuff from productivity apps to JR...

91 views 2 7
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