I did some research and found this can be done by using /rest/api/2/issue/{issueIdOrKey}/transitions API.
For example, if there is one jira ticket `A`, and its current status is `Open`. Below is the step I followed.
Step 1: Get all the possible transitions through /rest/api/2/issue/A/transitions, say I get `Resolved` back.
Step 2: Update the ticket to `Resolved` status and call the API /rest/api/2/issue/A/transitions again to get the next possible transition status. Say this time I get `Closed` status back,
Step 3: Update the ticket status to close and Now `A` is closed.
My question:
1. There are many different issue types available for one project, such like `Bug`, `Support Request`, `Task` etc, and for each type, their transitions may be different. The close transition may call `Closed` for `Bug`, but it may call `Closed Issue` for `Support Request`. Is there a way to get which transition name means close?
2. Can I get all the transitions of one ticket back through one call ?Because /rest/api/2/issue/{issueIdOrKey}/transitions will only return the next available transition to me.
3. my request is to close the unclosed tickets, I hardcode some transitions name now to complete this but this should not a good way, is there a way i can get the relationships of all these transitions for one jira ticket?
Thanks.