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!
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"
}
}
}
]
}
@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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.