Hi,
I'm having a JIRA instance (version 7.13) running at localhost:8080. It has a project with key "JUL". I'm following the Jira's REST API tutorial here to create an issue remotely.
This is my request (GET) body:
http://localhost:8080/rest/api/2/issue/createmeta?projectKeys=JUL&issuetypeNames=Bug&expand=projects.issuetypes.fields
&data={
"fields": {
"project":
{
"key": "JUL"
},
"summary": "REST ye merry gentlemen.",
"description": "Creating of an issue using project keys and issue type names using the REST API",
"issuetype": {
"name": "Bug"
}
}
}
Some how I don't get the expected result in the tutorial but this error response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<status>
<status-code>500</status-code>
<message>key <fields
> doesn't match pattern</message>
<stack-trace>java.lang.RuntimeException: key <fields
> doesn't match pattern
at com.atlassian.plugins.rest.common.expand.parameter.DefaultExpandParameter$ExpandKey.from(DefaultExpandParameter.java:122)
at com.atlassian.plugins.rest.common.expand.parameter.DefaultExpandParameter$ExpandKey.access$000(DefaultExpandParameter.java:100)
at com.atlassian.plugins.rest.common.expand.parameter.DefaultExpandParameter.appendParam(DefaultExpandParameter.java:67)
at ......
The error log is exceeded 2000 chars, basically I think that may be there was some problem with my <fields> JSON structure, may be the document was not up-to-date, but I don't know where to find the correct structure for that. Could you please give me some tips on this, thank you.
Hi @Hy Nguyen
The method you are calling
http://localhost:8080/rest/api/2/issue/createmeta
returns meta data about the project and IssueTypes available for use. It isn't a method for creating issues so won't accept your new issue data.
"The fields that can be set on create, in either the fields parameter or the update parameter can be determined using the /rest/api/2/issue/createmetaresource. If a field is not configured to appear on the create screen, then it will not be in the createmeta, and a field validation error will occur if it is submitted."
I recommend installing REST API browser in a dev copy of JIRA for exploring these options.
To create an issue use POST method to
http://localhost:8080/rest/api/2/issue
with the new issue JSON in the request body
You will need to use the internal id's for project and issue type as returned from the createmeta call.
See examples here
https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.