Why am I getting a 405 from this request?

Corey Dulecki October 26, 2015

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

0 votes
Daniel Faba
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 26, 2015

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
TAGS
AUG Leaders

Atlassian Community Events