magdmartin
magdmartin

Reputation: 1787

Track number of download of a release (binaries) on Github

So now you can manage and publish your binaries directly on Github, the feature is back from early this month (source).

I've been looking around Github interface and I haven't seen a download tracker. This is a feature Google Code offer and I was wondering if Github has the same.

Please note, I am not interested to know the number of download of a repo, this is a different topic.

Upvotes: 17

Views: 5759

Answers (3)

Evan Siroky
Evan Siroky

Reputation: 9438

You can add a badge to your github repo. See this answer for more details.

Also, there is a nifty project that shows all of this data in a nice website which is over here: https://www.somsubhra.com/github-release-stats/

Upvotes: 1

magdmartin
magdmartin

Reputation: 1787

Based on Petros answer, I used the two following curl command:

To get the list of all releases including their id and number of download:

 curl -i  https://api.github.com/repos/:owner/:repo/releases -H "Accept: application/vnd.github.manifold-preview+json"

For example to list all the release for the OpenRefine project:

 curl -i  https://api.github.com/repos/openrefine/openrefine/releases -H "Accept: application/vnd.github.manifold-preview+json"

Then to get details on each release (you will need to run the first query to get the release id)

curl -i  https://api.github.com/repos/:owner/:repo/releases/assets/:release_id -H "Accept: application/vnd.github.manifold-preview+json"

With the same example to list the details including download number for google-refine-2.5-r2407.zip

curl -i  https://api.github.com/repos/openrefine/openrefine/releases/assets/6513 -H "Accept: application/vnd.github.manifold-preview+json"

Upvotes: 17

Petros
Petros

Reputation: 8992

You can use the GitHub API to get the download_count among other things for a single release asset:

http://developer.github.com/v3/repos/releases/#get-a-single-release-asset

This is how it looks currently, but please check the link above just in case anything changed since this answer was written.

GET /repos/:owner/:repo/releases/assets/:id

{ "url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1", "id": 1, "name": "example.zip", "label": "short description", "state": "uploaded", "content_type": "application/zip", "size": 1024, "download_count": 42, "created_at": "2013-02-27T19:35:32Z", "updated_at": "2013-02-27T19:35:32Z" }

Upvotes: 9

Related Questions