2
votes

enter image description here

Is there any way to get information (in JSON or Java objects) about Clones, Unique Clones, Views and Unique Visitors using github API on the basis of date or month or year?

2

2 Answers

2
votes

Not that I know of: both the repos API and the statistic API do not expose those data.

All you have are "followers" (as I mentioned in 2012) but https://github.com/<username>/<reponame>/graphs/traffic remains the only source for traffic-related data.

0
votes

Perhaps it is a bit late (almost 6 years), but, is this what you're looking for? Following the link, we see two examples to download clones information from a github repo:

In order to download the clones in shell, use:

curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/repos/octocat/hello-world/traffic/clones

In order to download the clones in javascript, use:

await octokit.request('GET /repos/{owner}/{repo}/traffic/clones', {
  owner: 'octocat',
  repo: 'hello-world'
})

The result is a JSON object:

{
  "count": 173,
  "uniques": 128,
  "clones": [
    {
      "timestamp": "2016-10-10T00:00:00Z",
      "count": 2,
      "uniques": 1
    },
    ...
  ]
}

The ... indicate more values (follow the link for the complete example).