GitHub API: Number of Stars of a Repository Over Time

Viewed 1379

Is there a way to retrieve information about the number of stars of a GitHub repository over time? I know I can get a list of all users who starred a repository using the stargazers API endpoint. This doesn't include information about when each user has starred the repo, though. Any hints on how I can retrieve this data?

1 Answers

You can get the property starred_at using this custom media :

Accept: application/vnd.github.v3.star+json

Your headers might look something like this (I'm using Javascript here):

headers: {
    ...
    Accept: 'application/vnd.github.v3.star+json',
    ...
},

See the documentation here: https://developer.github.com/v3/activity/starring/#alternative-response-with-star-creation-timestamps

This repository: https://github.com/timqian/star-history uses this technique to retrieve the stars over time to create a chart.

Related