GitHub v3 REST API

Get all contributor commit activity

Returns the total number of commits authored by the contributor. In addition, the response includes a Weekly Hash (weeks array) with the following information:

  • w - Start of the week, given as a Unix timestamp.
  • a - Number of additions
  • d - Number of deletions
  • c - Number of commits
get
http://HOSTNAME/api/v3/repos/{owner}/{repo}/stats/contributors

Path Parameters

ownerstringrequired
repostringrequired

Response

application/json
  • w - Start of the week, given as a Unix timestamp.
  • a - Number of additions
  • d - Number of deletions
  • c - Number of commits

Contributor Activity

authorobject | nullrequired

Simple User

Show Child Parameters
totalintegerrequired

Example:135

weeksarray[object]required

Example:[{"w":"1367712000","a":6898,"d":77,"c":10}]

Show Child Parameters
get/repos/{owner}/{repo}/stats/contributors
 
application/json

Get the weekly commit count

Returns the total commit counts for the owner and total commit counts in all. all is everyone combined, including the owner in the last 52 weeks. If you’d like to get the commit counts for non-owners, you can subtract owner from all.

The array order is oldest week (index 0) to most recent week.

get
http://HOSTNAME/api/v3/repos/{owner}/{repo}/stats/participation

Path Parameters

ownerstringrequired
repostringrequired

Response

application/json

The array order is oldest week (index 0) to most recent week.

Participation Stats

allarray[integer]required
ownerarray[integer]required
get/repos/{owner}/{repo}/stats/participation
 
application/json

Get the hourly commit count for each day

Each array contains the day number, hour number, and number of commits:

  • 0-6: Sunday - Saturday
  • 0-23: Hour of day
  • Number of commits

For example, [2, 14, 25] indicates that there were 25 total commits, during the 2:00pm hour on Tuesdays. All times are based on the time zone of individual commits.

get
http://HOSTNAME/api/v3/repos/{owner}/{repo}/stats/punch_card

Path Parameters

ownerstringrequired
repostringrequired

Response

application/json

For example, [2, 14, 25] indicates that there were 25 total commits, during the 2:00pm hour on Tuesdays. All times are based on the time zone of individual commits.

Code Frequency Statarray[array]

Code Frequency Stat

get/repos/{owner}/{repo}/stats/punch_card
 
application/json

Create a commit status

Users with push access in a repository can create commit statuses for a given SHA.

Note: there is a limit of 1000 statuses per sha and context within a repository. Attempts to create more than 1000 statuses will result in a validation error.

post
http://HOSTNAME/api/v3/repos/{owner}/{repo}/statuses/{sha}

Path Parameters

ownerstringrequired
repostringrequired
shastringrequired

Body

application/json
statestringrequired

The state of the status. Can be one of error, failure, pending, or success.

Allowed values:errorfailurependingsuccess

target_urlstring

The target URL to associate with this status. This URL will be linked from the GitHub UI to allow users to easily see the source of the status.
For example, if your continuous integration system is posting build status, you would want to provide the deep link for the build output for this specific SHA:
http://ci.example.com/user/repo/build/sha

descriptionstring

A short description of the status.

contextstring

A string label to differentiate this status from the status of other systems. This field is case-insensitive.

Default:default

Response

201 application/json

Response

Status

The status of a commit.

urlstringrequired
avatar_urlstring | nullrequired
idintegerrequired
node_idstringrequired
statestringrequired
descriptionstringrequired
target_urlstringrequired
contextstringrequired
created_atstringrequired
updated_atstringrequired
creatorobject | nullrequired

Simple User

Show Child Parameters
post/repos/{owner}/{repo}/statuses/{sha}

Body

{ "state": "success", "target_url": "https://example.com/build/status", "description": "The build succeeded!", "context": "continuous-integration/jenkins" }
 
201 application/json

List repository tags

get
http://HOSTNAME/api/v3/repos/{owner}/{repo}/tags

Query Parameters

per_pageinteger

Results per page (max 100)

Default:30

pageinteger

Page number of the results to fetch.

Default:1

Path Parameters

ownerstringrequired
repostringrequired

Response

200 application/json

Response

Tag

namestringrequired

Example:v0.1

commitobjectrequired
Show Child Parameters
zipball_urlstring(uri)required

Example:https://github.com/octocat/Hello-World/zipball/v0.1

tarball_urlstring(uri)required

Example:https://github.com/octocat/Hello-World/tarball/v0.1

node_idstringrequired
get/repos/{owner}/{repo}/tags
 
200 application/json