I’m trying to use the rest api in c# to update a Jira ticket. The ticket has a number of buttons such as Edit, Comment, Assign, More, Start Progress, Resolve Issue, Close Issue.
However I can only see the last three (Start Progress, Resolve Issue, Close Issue) when I use something like: https://jira/rest/api/2/issue/[issue-number]/transitions?expand=transitions.fields
Hi @JohnLawlor1. Welcome to the developer community forums. So, you’re seeing the available transitions for the user that’s making the API call. If you want to edit more of the fields/data related to an issue, you can use the Edit Issue API method (PUT):
Because you also mentioned comment in your post, there’s another method for that, the Add Comment API method (POST):
Sorry, i’m not completely clear on how I would select the edit button in the ticket if I can’t see it.
/rest/api/2/issue/{ticket-id}/editmeta
doesn’t have the ‘Edit’ button I wish to click on.
This command /rest/api/2/issue/%5Bissue-number%5D/transitions?expand=transitions.fields
shows me all the buttons I can interact with. For example the ‘Close Issue’ has an Id of 301, so I can use
request.Content = new StringContent("{\"transition\":{\"id\":\"301\"}}"
var response = await httpClient.SendAsync(request); to update.
If I was to click the ‘Edit’ button manually, it brings up a subform, which I need to interact with.
Hello @JohnLawlor1
You’re confusing Buttons on the screen with Fields on the screen.
expand=transitions.fields
shows me all the buttons I can interact with
Those things being returned from the Get Transitions endpoint are not Buttons, they are Fields, and they just happen to have the same NAME as some Buttons on the screen. The method you’ve used to change the selected value of one of those Fields is just causing the equivalent outcome as if a user pushed the Button in the GUI that transitions the issue to another status.
The REST API cannot ‘push’ or ‘click’ Buttons.
So, because the Edit Button’s function is to bring up a sub-form in the GUI and there is no equivalent field that can have any value to make that happen, there is nothing the REST API can do to make that sub-form appear.