Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to identify repository name from repository ID (on disk)?

Mira Hedl August 4, 2016

This question is in reference to Atlassian Documentation: Identifying a Repository on the Stash Server

This is only repository name to <repository-id> mapping. How to figure out repository when I have an ID. With more than 2000 repositories, clicking on all "Settings" for each repo is ridiculous.

1 answer

1 accepted

3 votes
Answer accepted
G__Sylvie_Davies__bit-booster_com_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 4, 2016

Use the "/repos" REST API GET request to get a dump of all repos quickly.  Be sure to authenticate first as an admin so that all are visible.  Since you have over 2,000 repos, you'll need to use the paging API.  It would be something like this:

 

http://[your-server]/rest/api/1.0/repos?limit=1000&amp;start=0
http://[your-server]/rest/api/1.0/repos?limit=1000&amp;start=1000
http://[your-server]/rest/api/1.0/repos?limit=1000&amp;start=2000
etc...

 

The result includes an "id" attribute inside each returned repository JSON object:

values: [
{
  slug: "aui",
  id: 2,
  name: "aui",
  scmId: "git",
  // etc...
},
{
  slug: "my_repo",
  id: 11,
  name: "my_repo",
  scmId: "git",
  // etc...
}]

 

You can use this data to build up your ID -> Repo-Name reverse-lookup table.

 

Here's an example using my flaky demo VM (might not respond):   http://vm.bit-booster.com/bitbucket/rest/api/1.0/repos?limit=1&start=0

 

p.s.  I'm the author of a Marketplace add-on:  Bit-Booster Commit Graph And More

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events