Dev
Dev

Reputation: 13753

Get information about Clones, Unique Clones, Views and Unique Visitors using github API

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?

Upvotes: 2

Views: 1029

Answers (2)

Lluís Alemany-Puig
Lluís Alemany-Puig

Reputation: 1188

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).

Upvotes: 1

VonC
VonC

Reputation: 1323793

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.

Upvotes: 2

Related Questions