REST API - get asset size


Is there a way to get the asset size using the rest api?
I have tried /v1/asset and /v1/asset{id} on a raw hosted repo but the response json doesn’t contain a size field. I need filename, sha256 and size. First two are available in json response.


Could you make a HEAD request to the asset path? I believe you could use the content-length to know the size of the asset.

1 Like

Thanks. You are right. The HEAD request provides the Content-Lenght which is the size of the pointed resource.


Sorry to reanimate this old post, but for me doing a HEAD request is not an option:
We have some scripts that use the API to search for old artifacts. We then want to print a list a list of artifacts and when they will be removed from the repo. We would like to include their sizes, so we get a feeling of how much space we will be saving by the delete.
However, when we send a HEAD request, the last download time is reset! Therefore no artifacts would ever be deleted anymore if you try to get the size with a HEAD…

Is there no other way to get the size of an asset from the API??