Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JIRA REST API bulk create tickets

Josh Bray April 12, 2019

I am attempting to use the REST API to bulk create tickets and there are likely a few items I am missing - I am able to create a single issue, but not multiple.

 

Successful single issue:

Command:

curl -D- -k -u user:password -X POST --data @ticket_data.json -H "Content-Type: application/json" https://company.atlassian.net/rest/api/3/issue/

 Content of ticket_data.json:

{
"fields": {
"project":
{
"key": "TEST"
},
"summary": "Review site for core, plugin, theme updates.",
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "description"
}
]
}
]
},
"issuetype": {
"name": "Task"
}
}
}

 

I understand there is a bulk resource via https://company.atlassian.net/rest/api/3/issue/bulk, but it is possible that I am mistaken in this OR my json file syntax is off though it does validate properly via a 3rd party checker.

Bulk command: 

curl -D- -k -u user:password -X POST --data @ticket_data_bulk.json -H "Content-Type: application/json" https://company.atlassian.net/rest/api/3/issue/bulk

Content of ticket_data_bulk.json:

[
{
"fields": {
"project":
{
"key": "TEST"
},
"summary": "Review site for core, plugin, theme updates.",
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "description"
}
]
}
]
},
"issuetype": {
"name": "Task"
}
}
},
{
"fields": {
"project":
{
"key": "TEST2"
},
"summary": "Review site for core, plugin, theme updates.",
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "description"
}
]
}
]
},
"issuetype": {
"name": "Task"
}
}
}
]

 

Here is the error I am receiving:

{"errorMessages":["Can not deserialize instance of com.atlassian.jira.rest.v2.issue.IssuesUpdateBean out of START_ARRAY token\n at [Source: org.apache.catalina.connector.CoyoteInputStream@2c4404a6; line: 1, column: 1]"]}

 

Bit out of my element here and any help would be GREATLY appreciated!
 

1 answer

1 accepted

1 vote
Answer accepted
Alex Gallien
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.
April 12, 2019

Hi Josh, I'd try wrapping the whole thing under the key issueUpdates, like this:

{ 
"issueUpdates":[
{
"fields":{
"project":{
"key":"TEST"
},
"summary":"Review site for core, plugin, theme updates.",
"description":{
"type":"doc",
"version":1,
"content":[
{
"type":"paragraph",
"content":[
{
"type":"text",
"text":"description"
}
]
}
]
},
"issuetype":{
"name":"Task"
}
}
},
{
"fields":{
"project":{
"key":"TEST2"
},
"summary":"Review site for core, plugin, theme updates.",
"description":{
"type":"doc",
"version":1,
"content":[
{
"type":"paragraph",
"content":[
{
"type":"text",
"text":"description"
}
]
}
]
},
"issuetype":{
"name":"Task"
}
}
}
]
}
Josh Bray April 13, 2019

@Alex Gallien I really appreciate your response and am glad it was an easy fix!  I saw 

"issueUpdates"

referenced in the documentation for bulk updating issues, but since I was creating issues I tried using "issueCreate" with no luck obviously.

Suggest an answer

Log in or Sign up to answer