How to retrieve deployments on a Jira issue using REST API

Denis Blanchette October 7, 2019

I followed the documentation "Integrating Jira Software Cloud with on-premises tools" and was able to set a deployment on Jira issues.

I see the API allows me to get deployments by keys or properties. It would be very useful to get the deployments associated to a Jira issue by API.

I found that you can get that information using the issue property API and by getting the property called "asap:micros-group/jswdd*deployments". However, this is not documented and thus can probably change in the future. Also, this forces me to use a different set of credentials because the OAuth 2.0 credentials do not work with that API.

As a workaround, I was thinking about setting a property called "IssueId" on all deployments I submit to the API. This would force me to create several deployments objects for the same actual deployment. That is not the way the API is meant to be used.

Another workaround (which I'll probably end up doing) is to keep a mapping in my system.

My questions are:

  1. What is the recommended way to get deployments for a Jira issue?
  2. Is it safe to use the property "asap:micros-group/jswdd*deployments"? Will that get renamed or deleted at some point?
  3. Can I use OAuth 2.0 credentials to get that info?

3 answers

1 accepted

3 votes
Answer accepted
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 15, 2020

Not sure it is still helpful, but you can also try the below internal REST API endpoint (not officially supported/documented as well):

 

The above endpoints should return all the info that is usually displayed in the development panel of an issue. 

 

Cheers,
Dario

Denis Blanchette December 16, 2020

That is exactly what I needed! Thank you very much.

Any chance it becomes official? I was able to get the same result with the GraphQL API but it is a lot harder to use.

Like Dario B likes this
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 17, 2020

Hello @Denis Blanchette ,

We have the below feature request open in our system since couple of years in order to have a public REST API endpoint to get the information displayed in the development panel:

As you can see the provided endpoints are documented as the workaround for this feature request that got around 50 votes so far. Therefore, we can safely assume that the provided endpoints will keep on working for still some time, or they will be replaced by official ones.

 You may want to vote and watch the above feature request so that you will get notified in case of any update. The  feature will be addressed according to the Implementation of New Features Policy.

 

Cheers,
Dario

Like Denis Blanchette likes this
1 vote
unruh-r
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 27, 2020

Another undocumented way is POSTing to "https://your-instance.atlassian.net/jsw/graphql?operation=DevDetailsDialog" and in the body an issue ID (not the key; it should be an int) and a graph ql query. Use devtools to see Jira make this call to itself when you open the deployments section of the ticket.

Example body:

'{

"operationName":"DevDetailsDialog",
"query":"\n query DevDetailsDialog ($issueId: ID!) {\n developmentInformation(issueId: $issueId){\n \n details {\n instanceTypes {\n id\n name\n type\n typeName\n isSingleInstance\n baseUrl\n devStatusErrorMessages\n repository {\n name\n avatarUrl\n description\n url\n parent {\n name\n url\n }\n branches {\n name\n url\n createReviewUrl\n createPullRequestUrl\n lastCommit {\n url\n displayId\n timestamp\n }\n pullRequests {\n name\n url\n status\n lastUpdate\n }\n reviews {\n state\n url\n id\n }\n }\n commits{\n id\n displayId\n url\n createReviewUrl\n timestamp\n isMerge\n message\n author {\n name\n avatarUrl\n }\n files{\n linesAdded\n linesRemoved\n changeType\n url\n path\n }\n reviews{\n id\n url\n state\n }\n }\n pullRequests {\n id\n url\n name\n branchName\n branchUrl\n lastUpdate\n status\n author {\n name\n avatarUrl\n }\n reviewers{\n name\n avatarUrl\n isApproved\n }\n }\n }\n danglingPullRequests {\n id\n url\n name\n branchName\n branchUrl\n lastUpdate\n status\n author {\n name\n avatarUrl\n }\n reviewers{\n name\n avatarUrl\n isApproved\n }\n }\n buildProviders {\n id\n name\n url\n description\n avatarUrl\n builds {\n id\n buildNumber\n name\n description\n url\n state\n testSummary {\n totalNumber\n numberPassed\n numberFailed\n numberSkipped\n }\n lastUpdated\n references {\n name\n uri\n }\n }\n }\n }\n deploymentProviders {\n id\n name\n homeUrl\n logoUrl\n deployments {\n displayName\n url\n state\n lastUpdated\n pipelineId\n pipelineDisplayName\n pipelineUrl\n environment {\n id\n type\n displayName\n }\n }\n }\n featureFlagProviders {\n id\n createFlagTemplateUrl\n linkFlagTemplateUrl\n featureFlags {\n id\n key\n displayName\n providerId\n details{\n url\n lastUpdated\n environment{\n name\n type\n }\n status{\n enabled\n defaultValue\n rollout{\n percentage\n text\n rules\n }\n }\n }\n }\n}\n remoteLinksByType {\n providers {\n id\n name\n homeUrl\n logoUrl\n documentationUrl\n actions {\n id\n label {\n value\n }\n templateUrl\n }\n }\n types {\n type\n remoteLinks {\n id\n providerId\n displayName\n url\n type\n description\n status {\n appearance\n label\n }\n actionIds\n attributeMap {\n key\n value\n }\n }\n }\n }\n \n embeddedMarketplace {\n shouldDisplayForBuilds,\n shouldDisplayForDeployments,\n shouldDisplayForFeatureFlags\n }\n\n }\n\n }\n }",
"variables":{"issueId":"12345"}
}'

Denis Blanchette December 16, 2020

Sorry, I forgot to reply. It does work and is a good workaround. Thanks!

Like Dario B likes this
0 votes
Praximax
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 21, 2023

Hi folks. I was looking for something like this. Thanks @Dario B for the answer and @Denis Blanchette for posting it here. 

However, I have a slight problem. The "Dev-Status" API doesn't seem to accept OAuth2.0 credentials (which we use everywhere else). 

I would be perfectly happy to use Get Deployments by Key but I am not quite sure how does one get this key!

Would be grateful for any help. 

Thanks in advance.

Suggest an answer

Log in or Sign up to answer