Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

size of stash repositories via rest

we've got a large number of repos and I would like to get an overview of the sizes of each of these repos. Is there a way to get the repository size available under settings/repository details via REST API call?

3 answers

1 accepted

0 votes
Answer accepted

Hi Robbin,

Unfortunately that information isn't directly accessible via any Stash REST API:

It would be trivial to add this to a plugin - you just need to expose this method:

https://developer.atlassian.com/static/javadoc/stash/latest/api/reference/com/atlassian/stash/repository/RepositoryService.html#getSize%28com.atlassian.stash.repository.Repository%29

Let me know if you're interesting, I'm happy to show you how this could be done.

Cheers,

Charles

hi, I tried last time to write plugins, and currently I simply don't have the time right now to learn java, eclipse, maven etc all things that are needed to write plugins. If you can show me to to get the repository size count from stash that would be appreciated.

that was exactly what I needed! Could be nice if the rawSize and size were parameters for /rest/reposize/latest/projects/$proj/repos/$repo, but this absolutely works! thank you, it's very much appreciated.

Hi Robbin, what do you mean parameters sorrry?

what I mean was that it would be nice it sizeRaw and size were part of the json parameters returned by /rest/api/1.0/projects/$prj/repos/$repo, but your solution works excellent. And I do appreciate the example source code, I'll have a look at it when time allows and see if I can pick up writing plugins.

might be my vault, my brain hurts from trying to juggle to many tasks at the same time.

My first thought was to look for repository sizes when doing for example: "curl https://stash.silabs.com/rest/api/1.0/projects/cad/repos/gitbm". I was hoping that sizeRaw and size would have been part of the json string returned.

My apologies Robbin, I'm a little slow this morning, I'm still not sure what you mean (and would like to). Could you show me an example of the JSON output you were thinking of?

Ohhh. Now I see.

Yeah that's not really possible in a plugin - I would have to update core Stash (and then you would have to wait for the next release). Given that getting the size of the repository is not cheap/free I suspect that's not likely to happen. Sorry. :(

ok, perhaps it might become available as /rest/api/1.0/projects/{}/repos/{}/size or /rest/api/1.0/projects/{}/repos/{}/settings one day. Until then I'm good with this plugin.

Does this plugin still work with the newer 5.x versions of Bitbucket?

Looks like bit bucket makes following simple AJAX call (http get) when it tries to get the aprox size on it's UI:

https://<Git URL>/projects/<project name>/repos/<repo name>/sizes

It can easily be converted to a curl and can work as an API...

Yes this is do-able gives back the following json

{u'attachments': 0, u'repository': 642}

 

Thanks for the answer, i guess this can change at any time but it's better than nothing.

I have a small python script that will get you this info:

https://github.com/gsj889/bitbucket-repo-size

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Calling any interview participants for Bitbucket Data Center

Hi everyone,  We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...

504 views 6 4
Read article

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