Forums

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

Can not deserialize instance of com.atlassian.jira.rest.v2.issue.IssueUpdateBean out of START_ARRAY

Jack January 4, 2023

I am getting this error when sending a PUT request rest/api/2/issue/issueKey

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


Request body is: 
{
  "update":{
       "customfield_10802":[
            {
                "set":{
                   "value":"ja"
                }
            }          
         ]
   }   
}

Any Ideas ? 

1 answer

0 votes
Florian Bonniec
Community Champion
January 4, 2023

Hi @Firas 

 

What is the payload you send ?

 

Regards

Jack January 4, 2023

Hi @Florian Bonniec ,
- this is the payload :
{
  "update":{
       "customfield_10802":[
            {
                "set":{
                   "value":"ja"
                }
            }          
         ]
   }   
}

and this is the field definition : 

{
"customfield_10802": {
"required": false,
"schema": {
"type": "option",
"custom": "com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons",
"customId": 10802
},
"name": "Zeuspunkt",
"fieldId": "customfield_10802",
"operations": [
"set"
],
"allowedValues": [
{
"self": "https://example/rest/api/2/customFieldOption/108086",
"value": "ja",
"id": "108086",
"disabled": false
},
{
"self": "https://example/rest/api/2/customFieldOption/108087",
"value": "nein",
"id": "108087",
"disabled": false
}
]
}
}

Florian Bonniec
Community Champion
January 4, 2023

How this payload is generated ?

Do you do in in code or do you try using a tool such as Postman ?

 

Seems like there is a special character somewhere or encoding issue.

 

Regards

Jack January 4, 2023

I use code. More specifically, I use the Google Ouath client to perform the PUT request.


Something like the following code snippet:  

 

public void updateJiraIssue(String issueKey, String jiraAccesstoken, String verfifier) throws JiraConnectionException {

ObjectMapper mapper = new ObjectMapper();
ObjectNode bodyNode = mapper.createObjectNode();
ObjectNode updateNode = bodyNode.putObject("fields");
bodyNode.putObject("update");
ObjectNode customfield_10802 = mapper.createObjectNode();
customfield_10802.put("value", "ja");
updateNode.set("customfield_10802", customfield_10802);

try {
OAuthParameters parameters = jiraOAuthClient.getParameters(jiraAccesstoken, verfifier, consumerKey, privateKey);
final HttpContent content = new JsonHttpContent(new GsonFactory(), bodyNode);
putRequest(parameters, new GenericUrl(baseUrlIssue + issueKey), content).get();

} catch (Exception e) {
e.printStackTrace();
log.error("Error while handling request to {}", baseUrlIssue, e);
throw new JiraConnectionException("Error handling request when update issue by id.", baseUrlIssue, e);
}

}

Jack January 4, 2023

The same payload works correctly when I run the request via Postman. Only when I run the request with code, I get the error message.

Suggest an answer

Log in or Sign up to answer