How do I close a JIRA issue with PHP? My modified snippet below still causes an error when changing the resolution:
$newData = [ 'state' => 'resolved' ];
$result = $client->applyTransition($userAuth, $ticketKey, $newData);
How do I close a JIRA issue with PHP? My modified snippet below still causes an error when changing the resolution:
$newData = [ 'state' => 'resolved' ];
$result = $client->applyTransition($userAuth, $ticketKey, $newData);
hey, try sending the transition field with the appropriate numeric id instead of updating a state field. i had to pull available transitions first so i could pick the right one to mark as resolved. hope that helps!
In my experience, the issue often comes down to using an incorrect field for the transition action. I encountered a similar challenge where updating the ‘state’ field did nothing because the API expects a properly formatted transition object with a valid transition id. I ended up checking my workflow for the ticket and found that I had to pass the transition id in a ‘transition’ field, not a ‘state’. It was a matter of aligning my code with the JIRA API’s expected JSON structure according to the specific workflow configured for my projects.
The key is to use the correct transition payload, not just updating a state field. I learned this from troubleshooting similar issues in my projects. Instead of sending a simple field like ‘state’, you have to submit a properly structured transition object that includes the numeric id of the desired transition. For example, retrieving the list of available transitions for an issue helps identify the right id for resolving the ticket. Once I updated my payload format accordingly, the JIRA API accepted my request without error.
I encountered this issue while updating a JIRA ticket through PHP and discovered that the main problem was typically the payload format. It wasn’t enough to just change an arbitrary field; the API expects a proper transition object that includes a correct numeric transition id. I had success by first fetching the list of transitions available for the ticket, which helped me select the appropriate id. Also, I ensured that my authentication and API endpoint details were consistent with JIRA’s documentation. Adjusting these aspects resolved the error for me.