0

I'm trying to get the size of a Stash repository via the REST API. So far I tried

python -c "import requests; print(requests.get('https://<Stash URL>/rest/api/1.0/projects/<project>/repos/<repo>', headers={'Authorization': 'Basic <credentials>', 'Content-Type': 'application/json'}).content)"

, but the result does not contain the size of the repository. Any help would be appreciated, thanks.

  • 1
    What *exactly* do you mean by the 'size'? – tgdavies Feb 05 '22 at 04:21
  • @tgdavies The disk space consumed by the files in the repository. (What "du -s" would output if I cloned the repository.) – Attila Csabai Feb 05 '22 at 08:22
  • I found something probably useful in another thread ([link](https://stackoverflow.com/questions/43156128/can-i-get-the-size-of-a-repository-on-bit-bucket-server-using-the-rest-api)): `https:///projects//repos//sizes`, although the size reported by this and the du output after cloning is quite different... – Attila Csabai Feb 06 '22 at 03:24
  • that does not work for bb server 7.21.1 - it does not know `sizes` endpoint... in https:///rest/api/1.0/projects//repos//sizes – Sasha Bond Jul 15 '22 at 20:32

0 Answers0