How to Create Issue via REST API in JIRA Studio 4.4 (hosted, not Ondemand)?

Martin Wickline February 28, 2012

REST API documentation for JIRA 4.4 https://developer.atlassian.com/static/rest/jira/4.4.1.html doesn't seem to include a way to create an Issue remotely.

I see that functionality in the JIRA 5.0 REST API documentation. https://developer.atlassian.com/static/rest/jira/5.0.html

I need to be able to create an issue via the remote API in JIRA 4.4 (specifically version 4.4-studio-rc2). Is there a non-REST remote API that supports issue creation in this version of JIRA (Studio, hosted)?

Please don't answer that we need to upgrade to OnDemand, I need something that can work today.

Thanks!

4 answers

1 accepted

0 votes
Answer accepted
Martin Wickline March 1, 2012

Finally figured it out, by repeated guess and check (without much help from the remote API error messages, which were pretty much all the same as above):

{'jsonrpc':'2.0',
 'method':'createIssue',
 'params': [ 'authToken',
             '{"description": "Some description", 
               ###"labels": ["a", "b"], ##Doesn't accept labels
               "summary": "A summary", 
               ### No sub-hashmaps, just direct values
               "project": "DUMMY", 
               ### Can't use issue type name, must use numeric ID
               "issuetype": "18",
               ### Date value uses Long seconds since epoch
               "duedate": 1345326445000}'
           ],
 'id': 'someRequestId',
}

1 vote
Barrett Cook
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 21, 2012

I ran into this issue and spent hours trying to create an issue. Here's how we solved it in node.

https://gist.github.com/3764020

The relevant part was that the "type" field (issue type) must be an integer (not a string).

1 vote
Dieter
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 28, 2012
0 votes
Bob Swift
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 29, 2012

createIssue action from the JIRA Command Line Interface . This action uses the SOAP API.

Martin Wickline February 29, 2012

Thanks for the responses. I'm trying to use the JSON-RPC variant of the SOAP API as documented here:

https://developer.atlassian.com/display/JIRADEV/JIRA+JSON-RPC+Overview

However, I'm getting an exception that isn't explained in the documentation that I can find:

{'jsonrpc': u'2.0', 
'id': 'dummyRequestId',
'error': {'message': 'Request parameter types did not match method parameter types (method createIssue taking 2 parameters)',
'code': -32602,
'data': None}
}

I'm sending something like the following in the POST JSON body:

{'jsonrpc':'2.0',
 'method':'createIssue',
 'params': [ 'authToken',

                  '{"description": "Some description", "labels": {"value": ["a", "b"]}, "summary": "A summary", "project": {"key": "DUMMY"}, "issuetype": {"name": "Bug"}, "duedate": {"value": "2012-02-01"}}'],
 'id':requestId,

}

BTW, I can grab an existing issue via the JSON-RPC call to getIssue(), and take the resulting JSON-formatted issue string and send it to the createIssue() selector and get this same error.

Any ideas?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events