I am trying to implement a functionality to auto close few tickets which meets a criteria. I am getting the errors mentioned below while making the API call to resolve the issue.
Command I am running:
curl -D- -u admin:admin -X POST --data @oracle_decomm_close_2 -H "Content-Type: application/json" "https://jiraxx.xxxx.com/rest/api/2/issue/DECOM-40322/transitions?expand=transitions.fields"
cat oracle_decomm_close_2
{
"update": {
"comment":[{"add": {"body": "Automatic closure of Oracle decommission ticket"}}],
"worklog":[{"add": {"timeSpent":"1m"}}],
"customfield_14881":{"value": "NO"}
},"transition": {"id": "5"}
}
Error:
{"errorMessages":["Can not deserialize instance of java.util.ArrayList out of START_OBJECT token\n at [Source: com.plugenta.jiraauditor.filter.RestReadingServletRequest$1@388e8ec2; line: 1, column: 139] (through reference chain: com.atlassian.jira.rest.v2.issue.IssueUpdateBean[\"update\"])"]}
New to json. Any help on this is highly appreciated.
Hello,
Do you mean that the problem is with customfield_14881? Are you sure about it? Did you try to do the POST without customfield_14881? Did it work? If you are sure that the problem is withcustomfield_14881then what is customfield_14881 custom field type?
Thanks for getting back Alexey.
I am not quite sure where the problem is. I figured that customfield_14881 is required to transition the ticket status to "Resolved". It wouldnt let me close the ticket from the front end, if this field is not set.
I am not sure how to find the type of the custom field. But I did a GET on an existing ticket, and found the below for this particular custom field.
"customfield_14881": {
"id": "17533",
"self": "https://jiraxx.xxxx.com/rest/api/2/customFieldOption/17533",
"value": "NO"
}
Please excuse my mistakes. Any help or guidance is appreciated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your JSON should be like this
{
"update": {
"comment":[{"add": {"body": "Automatic closure of Oracle decommission ticket"}}],
"worklog":[{"add": {"timeSpent":"1m"}}]
},
"fields": {
"customfield_14881":{"value": "NO"}
},"transition": {"id": "5"}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have a look in your atlassian-jira.log. It should work. The problem was that
"customfield_14881":{"value": "NO"} was in the update parameter. But it must be in the fields parameter. Aslo I supposed that your custom field is a single select
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Alexey.
Unfortunately I dont have access to the application logs. I will keep looking to get them.
Adding the custom field change to fields parameter still hasn't worked.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is the error?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try to install Jira REST API browser add-on(it is free) and check it there. You can query all REST API functions there. Have a look what will be the error there.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am getting this 500 status code when I am using below payload in my post request
{
"transition": {
"id": "41"
}
}
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.