It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

API get branches related to issue

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

0 votes

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
}
}
]
}

 

 

Finally, 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.

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

 

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

365 views 1 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you