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

This widget could not be displayed.

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 Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

97 views 1 0
Join discussion

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