Download project at commit level via REST Api

How do I go about downloading a given project at a certain commit point via the REST Api in zip format preferable or is that not possible?

Yes, this is absolutely possible. You just need to specify the SHA of the commit as a parameter, when you send the GET request. This SHA is completely optional. If omitted, the archive will contain a snapshot at the latest commit of the default branch.

You can even try this from your browser, to understand how it works.

For example:

You don’t need to specify the full SHA for this to work. However, it’s probably safer to use all 40 characters, especially when working with a project with a long history and many commits.

The optional SHA parameter is also detailed in the docs for the repositories end-point here:

Don’t forget to include the desired file extension. If you want a zip file, like you mentioned, you’ll need to specify (as in the above example).

Thanks Mark! That was exactly what I was looking for, I must have just missed the optional SHA part.

Hi sladd,

I’m glad you found a resolution to your issue. How did you save the archive stream to disk?