Error when attempting to update a fixVersion via Jira Rest API

Frank Oplinger July 12, 2017

Hey guys, I am currently having issues when trying to update a fix version using the JIRA rest api and Guzzle.

The error I am getting is a 400 with the following message:

{"errorMessages":["Can not deserialize instance of com.atlassian.jira.rest.v2.issue.IssueUpdateBean out of START_ARRAY t (truncated...)

 

The code I am using looks like this:

$aPostData = array(
'update' => array(
'fixVersions' => array(
array(
'set' => array(
array(
'name' => $strTag
)
)
)
)
)
);

$jsonStuff = \GuzzleHttp\json_encode($aPostData);

$response = $cGuzzel->request('PUT',$strJiraAPI, ['headers' => ['Content-Type' => 'application/json'],
'auth' => [JIRA_USER, JIRA_PASS],

'json'=>[$jsonStuff]

]);


Any help would be greatly appreciated!

2 answers

0 votes
Yatish Madhav
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.
August 11, 2020

Hi there - I am getting something similar ... I.e '{"errorMessages":["Can not deserialize instance of com.atlassian.jira.rest.v2.issue.IssueUpdateBean out of START_ARRAY token\\n at [Source: com.atlassian.plugin.connect.plugin.auth.scope.InputConsumingHttpServletRequest$1@60b5fd18; line: 1, column: 1]"]}'

Though I am getting it on create issue ... 

Please advise on where I can read up more on this type of error and on the fix or solution to it?

Thank you

0 votes
josh
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.
July 14, 2017

php :)

Can you be more specific about which REST endpoint you are trying to use? Are you updating the fixVersions field of an issue or are you modifying a fixversion on a project?

PUT /rest/api/2/issue/{issueIdOrKey}

or

PUT /rest/api/2/version/{id}

I'm assuming the first. I think the issue is malformed JSON. You have an extra array in there after 'set' => 

Suggest an answer

Log in or Sign up to answer