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.
Hi Christina,
I experienced a similar challenge when developing a test automation tool for JIRA workflows.
We have standardised statuses to prevent situations where there are multiple values representing the same state, such as "Closed" and "Closed Issue".
To answer your questions:
1. My solution was to create a mapping for workflows and their end statuses, so that depending on the workflow I could read from the mapping what the end state should be.
2. I believe you cannot.
3. Answer 2 and 3 result in this not being possible in a simple way. Closing unclosed tickets might be easier using the bulk change feature from JIRA.
Hope this helps.
Kind regards,
Wouter
Thanks tons Wouter. :) Regarding this, `Closing unclosed tickets might be easier using the bulk change feature from JIRA.` do we have an rest api for this ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No this can only be done through the interface.
Kind regards,
Wouter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.