Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 419a91e

Browse files
committed
GIT-6062 Provide additional info on branches api
1 parent 7e9c1c2 commit 419a91e

File tree

1 file changed

+98
-4
lines changed

1 file changed

+98
-4
lines changed

‎git-integration-for-jira-self-managed/Branches-API-gij-self-managed.md

Lines changed: 98 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ The Branches REST API will obtain list of branches associated to a Jira issue.
3232

3333
 
3434

35-
### url
35+
## Gets a set of branches from Jira issue based on the associated commit links
36+
37+
### Url
3638
`{JiraBaseURL}/rest/gitplugin/1.0/issues/branches?key={issuekey}`
3739

38-
### method
40+
### Method
3941
GET
4042

4143
### Parameters
@@ -46,7 +48,7 @@ GET
4648

4749
### Response
4850

49-
If the _optional query_ is not defined, it will return all indexed git branches.
51+
If the _optional query_ is not defined, it will return ALL indexed git branches. For example: `{JiraBaseURL}/rest/gitplugin/1.0/issues/branches`
5052

5153
### Example
5254

@@ -60,9 +62,101 @@ Result:
6062
}
6163
```
6264

65+
 
66+
67+
<div class="bbb-callout bbb--alert">
68+
<div class="irow">
69+
<div class="ilogobox">
70+
<span class="logoimg"></span>
71+
</div>
72+
<div class="imsgbox">
73+
If there are no commits associated with the specified task (ISSUE_KEY), no branches are going to be displayed for this request.
74+
</div>
75+
</div>
76+
</div>
77+
78+
&nbsp;
79+
80+
## Get the list of branches bound to an issue
81+
82+
A different request is used to retrieve branches on the "issue" page. It includes branches whose name is associated with the issue key.
83+
84+
### Url
85+
`{JIRA_BASE_URL}/rest/gitplugin/1.0/issuegitdetails/issue/{ISSUE_KEY}`
86+
87+
88+
### Method
89+
GET
90+
91+
### Parameters
92+
93+
| Field | Description |
94+
| :--- | :--- |
95+
| _**issueKey**_ | _String_. Optional.<br><br>This is the Jira Issue Key – a concatenation of Project key and Issue number. It must contain a dash ('-'). The _**issueKey**_ must be valid and existent.<br><br>For example: `TEST-435`. |
96+
97+
### Response
98+
99+
It includes branches whose name is associated with the issue. The result will show the branches on which commits exist in the specified Jira issue. It's a set of branches to which the commits are bound to the issue they are associated with. They can be viewed in the the Git Commits tab.
100+
101+
### Example
102+
103+
`https://jira.yourorg.com/rest/gitplugin/1.0/issuegitdetails/issue/TEST-435`
104+
105+
```json
106+
Result:
107+
{
108+
"commitCount": 53,
109+
"repositories":[
110+
{
111+
"repoId": 12718,
112+
"repoName": "test-repo",
113+
"isGitViewerEnabled": true,
114+
"isRepoApiEnabled": true,
115+
"branches":[
116+
{
117+
"name": "TEST-435-branch-001",
118+
"gkBranchUrl": "gitkraken://repolink/d5407d...4a03c/branch/TEST-435-branch-001?url=https%3A%2F%2Fgithub.com%2FWilyCoyote%2Ftest-repo.git",
119+
"glBranchUrl": "vscode://eamodio.gitlens/link/r/d5407d...4a03c/b/TEST-435-branch-001?url=https%3A%2F%2Fgithub.com%2FWilyCoyote%2Ftest-repo.git",
120+
"isAheadBehindPresented": true,
121+
"ahead": 2,
122+
"behind": 6448,
123+
"externalUrl": "https://github.com/WilyCoyote/test-repo/tree/TEST-435-branch-001"
124+
},
125+
{
126+
"name": "TEST-435-branch-002",
127+
"gkBranchUrl": "gitkraken://repolink/d5407d...4a03c/branch/TEST-435-branch-002?url=https%3A%2F%2Fgithub.com%2FWilyCoyote%2Ftest-repo.git",
128+
"glBranchUrl": "vscode://eamodio.gitlens/link/r/d5407d...4a03c/b/GIT-4932?url=https%3A%2F%2Fgithub.com%2FWilyCoyote%2Ftest-repo.git",
129+
"isAheadBehindPresented": true,
130+
"ahead": 0,
131+
"behind": 6379,
132+
"externalUrl": "https://github.com/WilyCoyote/test-repo/tree/TEST-435-branch-002"
133+
}
134+
]
135+
}
136+
],
137+
"enableBranchCreation": true,
138+
"gkEnabled": true,
139+
"glEnabled": true,
140+
"notAllPermissions": false
141+
}
142+
```
143+
144+
&nbsp;
145+
146+
### I made the correct request but I don't see the expected branches in the results?
147+
148+
If the issue displays these branches while the request does not, the likely explanation is that, the request is being executed by a user who lacks sufficient permissions to access the repository. (See the yellow infobox above.)
149+
150+
For a quick check, it is possible to omit the issue key in the request.
151+
152+
It will look like this: `https://jira.your-org.com/rest/gitplugin/1.0/issues/branches`
153+
154+
When a user is granted specific permissions, they will receive a json response that shows various branches.
155+
63156
&nbsp;
64157
<hr>
65158
&nbsp;
66159

67-
**[« Back to REST API index](/git-integration-for-jira-data-center/rest-api-gij-self-managed)**
160+
161+
**[« Back to: REST API index](/git-integration-for-jira-data-center/rest-api-gij-self-managed)**
68162

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /