API get branches related to issue

Sergey Shevchenko October 29, 2019

Hi is it a way to get all GIT branches related to particular ticket ?

I am using request /rest/dev-status/1.0/issue/detail?issueId=53082&applicationType=stash&dataType=repository

and it crash Jira

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>500</status-code><message>applicationType</message><stack-trace>java.lang.NullPointerException: applicationType
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:228)

1 answer

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.
October 31, 2019

Hi @Sergey Shevchenko ,

Welcome to the Atlassian Community!

Before going any further, please notice that the endpoints discussed in this thread are intended for internal use only. Therefore, they are not part of the official Jira Software REST APIs, they are not supported and they can change without any notice.

Once this has been said:

  1. You can use the internal endpoint http(s)://HOSTNAME/rest/dev-status/latest/issue/summary?issueId=<ISSUE_ID> (replace <ISSUE_ID> wit the actual ID of the Jira issue you want to GET the information from) to get the information displayed in the development panel of an issue. 


  2. You can use the information returned by above call to correctly populate the parameters for the endpoint you are already using  (for details, see the example at the bottom of this post).

    The error message you are getting is "complaining" about the value specified for the property applicationType. I was getting the same error message when I tried to call the endpoint passing the argument "applicationType=github" all lowercase instead of "applicationType=GitHub" . Therefore, make sure to use the exact same values you get from the 1st call for applicationType and dataType.

  3. We have the below feature requests open in our system to have an official endpoint to get the development information for an issue (for Jira Server and Cloud respectively):

     

    You may want to vote and watch one of the above feature request (depending on what you use) so that you will get notified in case of any update. The  feature(s) will be addressed according to the Implementation of New Features Policy.

 

EXAMPLE:

1) On my side calling https://NAME.atlassian.net/rest/dev-status/latest/issue/summary?issueId=10195 returns:

{
"errors": [],
"configErrors": [],
"summary": {
"pullrequest": {
"overall": {
"count": 0,
[..REMOVED..]
"dataType": "pullrequest",
"open": true
},
"byInstanceType": {}
},
"build": {
"overall": {
[..REMOVED..]
"dataType": "build"
},
"byInstanceType": {}
},
"review": {
"overall": {
[..REMOVED..]
"dataType": "review",
"completed": false
},
"byInstanceType": {}
},
"deployment-environment": {
"overall": {
[..REMOVED..]
"dataType": "deployment-environment"
},
"byInstanceType": {}
},
"repository": {
"overall": {
"count": 2,
"lastUpdated": "2019-10-31T17:53:18.000+0100",
"dataType": "repository"
},
"byInstanceType": {
"GitHub": {
"count": 2,
"name": "GitHub"
}
}
},
"branch": {
"overall": {
"count": 1,
"lastUpdated": null,
"dataType": "branch"
},
"byInstanceType": {
"GitHub": {
"count": 1,
"name": "GitHub"
}
}
}
}
}

 

2) Then, calling https://NAME.atlassian.net/rest/dev-status/latest/issue/detail?issueId=10195&applicationType=GitHub&dataType=branch returns:

{
"errors": [],
"detail": [
{
"branches": [
{
"name": "[REMOVED]-branch-SFF-27",
"url": "https://github.com/[REMOVED]/1st_repository/tree/[REMOVED]-branch-SFF-27",
"createPullRequestUrl": "https://github.com/[REMOVED]/1st_repository/pull/new/[REMOVED]-branch-SFF-27",
"repository": {
"name": "[REMOVED]/1st_repository",
"url": "https://github.com/[REMOVED]/1st_repository",
"branches": []
},
"lastCommit": {
"id": "85663xxxxxxxxxxxxx",
"displayId": "85663f",
"authorTimestamp": "2019-10-31T16:53:18.000+0000",
"url": "https://github.com/[REMOVED]/1st_repository/commit/85663fxxxxxxxxxxxxxxx",
"author": {
"name": "[REMOVED]"
},
"fileCount": 0,
"merge": false,
"message": "Create SFF-27 again",
"files": []
}
}
],
"pullRequests": [],
"repositories": [],
"_instance": {
"name": "GitHub",
"baseUrl": "https://github.com",
"type": "GitHub",
"id": "com.github.integration.production",
"typeName": "GitHub",
"singleInstance": true
}
}
]
}

 

 

Please let me know if you have any further question on this topic.

 

Cheers,
Dario

Sotiris Gk June 29, 2020

Hi Dario, 

 

I face a similar issue. Although, I have followed the above instructions, I still get the same error.

Here is the responses to my requests:

https://jirainstance/rest/dev-status/1.0/issue/summary?issueId=1447271

{"errors":[],"configErrors":[],"summary":{"pullrequest":{"overall":{"count":1,"lastUpdated":"2020-06-29T09:36:32.636+0100","stateCount":1,"state":"OPEN","details":{"openCount":1,"mergedCount":0,"declinedCount":0},"open":true},"byInstanceType":{"stash":{"count":1,"name":"Bitbucket Server"}}},"build":{"overall":{"count":0,"lastUpdated":null,"failedBuildCount":0,"successfulBuildCount":0,"unknownBuildCount":0},"byInstanceType":{}},"review":{"overall":{"count":0,"lastUpdated":null,"stateCount":0,"state":null,"dueDate":null,"overDue":false,"completed":false},"byInstanceType":{}},"deployment-environment":{"overall":{"count":0,"lastUpdated":null,"topEnvironments":[],"showProjects":false,"successfulCount":0},"byInstanceType":{}},"repository":{"overall":{"count":0,"lastUpdated":null},"byInstanceType":{}},"branch":{"overall":{"count":1,"lastUpdated":"2020-06-29T09:36:32.636+0100"},"byInstanceType":{"stash":{"count":1,"name":"Bitbucket Server"}}}}}

But when I try :
https://jiraInstance/rest/dev-status/1.0/issue/detail?issueId=1447271&applicationType=stash&dataType=branch

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>500</status-code><message>applicationType</message><stack-trace>java.lang.NullPointerException: applicationType
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:226)

 

Could you please advise?

Like Aaron Yang likes this
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 7, 2020

Hello @Sotiris Gk ,

Please avoid adding new replies to a thread from almost 2 years ago. You have much higher chances to get an answer if you open a new thread.

Also, I don't know how you called the REST API endpoint and I don't know if this is for Server or Cloud, but the error message is complaining about applicationType and is throwing a NullPointerException:

java.lang.NullPointerException: applicationType
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:226)

 

If you are using Curl on a *nix machine there are chances you forgot to put the url among quotes and therefore everything after the & is not taken into account:

https://jiraInstance/rest/dev-status/1.0/issue/detail?issueId=1447271&...

 

If this is not the case, please provide more details on whether this is for Server or Cloud and how you are actually sending your REST requests.

 

Cheers,
Dario

Yasashree March 15, 2021

Hi, I am using the postman tool, we are in the testing department. We need to get issue branch details and release details. How can achieve it?

Suggest an answer

Log in or Sign up to answer