Method Not Allowed when POST not allowed when trying to update Jira issue via REST API

Cory Sandahl February 3, 2012

5 answers

1 accepted

3 votes
Answer accepted
rich
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 5, 2012

You don't want to POST to editmeta. Editmeta is a template that will provide you with the sample body to use when you want to edit an issue. To edit an issue, you need to use a PUT against the issue resource. BTW, this is only available in JIRA 5. If it's not working for you, you're likely not on JIRA 5 yet.

If you want to play with the REST API in JIRA 5, go to https://jira.atlassian.com/plugins/servlet/restbrowser#/com-atlassian-jira-rest-jira-rest-filter (make sure you log in first).

Cory Sandahl February 5, 2012

Yes, just confirmed our OnDemand version is 4.4.1-studio-rc3. Crap. What is the process for upgrading / requesting upgrade to versoin 5? If I can't update issues through the REST API's, then they are of no use to us.

rich
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 5, 2012

OnDemand will be upgraded with JIRA 5 when it comes out. Another option is to use the XML-RPC/JSON-RPC updateIssue method (https://jira.atlassian.com/plugins/servlet/restbrowser#/com-atlassian-jira-ext-rpc-soap).

0 votes
Andy Brook [Plugin People]
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.
February 5, 2012

What is the version of JIRA this is using, the site isn't too giving?

To recap, JIRA 4.4.4 doesn't support POST to /issue http://docs.atlassian.com/jira/REST/4.4.4/

The 'latest' 2.0alpha api http://docs.atlassian.com/jira/REST/latest doesn't support POST to /issue

5.0rc3 does http://docs.atlassian.com/jira/REST/5.0-rc3/

To clarify earlier, you need to use PUT, not POST (with 5.0rc3+). But your not using 5.0 yet, so sorry if this doesn't actually help you get working now :x

0 votes
Andy Brook [Plugin People]
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.
February 4, 2012

Thanks for the reference, my answer is correct, it appears the example documentation is not. You probably want to be posting to https://nebula.atlassian.net/rest/api/latest/issue/TESTPROJ-15/editmeta

I've added a note on the page.

Cory Sandahl February 4, 2012

Posting to https://nebula.atlassian.net/rest/api/latest/issue/TESTPROJ-15/editmeta gives me the following error:

HTTP/1.1 404 Not Found

Server: nginx

Date: Sun, 05 Feb 2012 21:49:15 GMT

Content-Type: application/xml;charset=UTF-8

Connection: keep-alive

X-AREQUESTID: 829x57321x1

Set-Cookie: JSESSIONID=DCC44AEC770B65F8EC9A1D76ADD65F20; Path=/; HttpOnly

Set-Cookie: studio.crowd.tokenkey=""; Domain=.nebula.atlassian.net; Expires=Thu,

01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly

X-Seraph-LoginReason: OUT

Set-Cookie: studio.crowd.tokenkey=8lX2J1wuWwKoZkgEqCAH1g00; Domain=.nebula.atlas

sian.net; Path=/; HttpOnly

X-Seraph-LoginReason: OK

Set-Cookie: atlassian.xsrf.token=B303-TZX0-KCYS-05LX|49ae25bf0d403b34f6ef0b42c86

e1e28bd552d66|lin; Path=/

X-AUSERNAME: corysandahl

Cache-Control: no-transform

Content-Length: 102

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>404<

/status-code></status>

0 votes
Cory Sandahl February 4, 2012

I'm drawing from the example provided in the Jira REST API Tutorials found here:

https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Edit+issues

The specific example I am trying to replicate is to change the assignee like the example below:

Examples of updating an issue using fields.

Example of assigning an issue to user "harry"

This simple edit

Request
curl -D- -u fred:fred -X PUT --data {see below} -H "Content-Type: application/json" http://kelpie9:8081/rest/api/2/issue/QA-31

example input data

{
"fields": {
"assignee":{"name":"harry"}
}
}
Response

You should just receive a response with a status of "204 No Content"

So my call to:

C:\Program Files (x86)\Git\bin>curl -D- -u myuser:password -X POST --data data.txt -H "Content-Type: application/json" https://nebula.atlassian.net/rest/api/latest/issue/TESTPROJ-15

Follows this pattern. My data.txt contains:

{
"fields": {
"assignee":{"name":"newuser"}
}
}

Whether PUT or POST is the desired method, neither are allowed in my case.

0 votes
Andy Brook [Plugin People]
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.
February 4, 2012

The error is correct, your API call is not valid for that /issue/{key} service. According to the API for issue resource URLS as you have them, POST is only available in some specific sub cases. What are you tryinig to update anyway, just POSting to the issue seems a little, vague? The current JIRA 5 RC3 APIs show some improvement, with a lot of attributes exposed through PUT, however not the one you are trying to use, I doubt the server you are using has yet moved to JIRA 5.

Suggest an answer

Log in or Sign up to answer