REST API endpoints for commits
Use the REST API to interact with commits.
Returns a list of commits for the specified repository. You can use query parameters to filter and paginate the results.
Parameters
| Name | Type | Description |
|---|---|---|
integrationId* | string | The unique identifier of your integration. This is used to track API usage and billing. |
correlationId* | string | The unique ID used to trace and link related requests across systems for debugging and monitoring. |
owner* | string | The account owner of the repository. The name is not case sensitive. |
repo* | string | The name of the repository without the .git extension. The name is not case sensitive. |
sha | string | SHA or branch to start listing commits from. Default: the repository default branch (usually main). |
path | string | Only commits containing this file path will be returned. |
author | string | GitHub username or email address to use to filter by commit author. |
committer | string | GitHub username or email address to use to filter by commit committer. |
since | string | Only show results that were last updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. |
until | string | Only commits before this date will be returned. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. |
per_page | integer | The number of results per page (max 100). For more information, see "Using pagination in the REST API." |
page | integer | The page number of the results to fetch. For more information, see "Using pagination in the REST API." |
Code samples for "List commits"
Request example
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.unizo.ai/repos/{owner}/{repo}/commitsResponse
Status: 200
{
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"node_id": "MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ==",
"commit": {
"author": {
"name": "Monalisa Octocat",
"email": "support@github.com",
"date": "2011-04-14T16:00:49Z"
},
"committer": {
"name": "Monalisa Octocat",
"email": "support@github.com",
"date": "2011-04-14T16:00:49Z"
},
"message": "Fix all the bugs",
"tree": {
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e"
}
}
}Returns the contents of a single commit reference. You must have read access for the repository to use this endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
integrationId* | string | The unique identifier of your integration. |
correlationId* | string | The unique ID used to trace and link related requests across systems. |
owner* | string | The account owner of the repository. |
repo* | string | The name of the repository without the .git extension. |
ref* | string | The commit SHA or branch name. |
Code samples for "Get a commit"
Request example
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.unizo.ai/repos/{owner}/{repo}/commits/{ref}Response
Status: 200
{
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"node_id": "MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ==",
"commit": {
"author": {
"name": "Monalisa Octocat",
"email": "support@github.com",
"date": "2011-04-14T16:00:49Z"
},
"committer": {
"name": "Monalisa Octocat",
"email": "support@github.com",
"date": "2011-04-14T16:00:49Z"
},
"message": "Fix all the bugs",
"tree": {
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e"
}
}
}Compares two commits against one another. You can compare branches in the same repository, or you can compare branches that exist in different repositories within the same repository network.
Parameters
| Name | Type | Description |
|---|---|---|
integrationId* | string | The unique identifier of your integration. |
correlationId* | string | The unique ID used to trace and link related requests across systems. |
owner* | string | The account owner of the repository. |
repo* | string | The name of the repository without the .git extension. |
base* | string | The base branch, tag, or SHA to use in the comparison. |
head* | string | The head branch, tag, or SHA to use in the comparison. |
page | integer | The page number of the results to fetch. |
per_page | integer | The number of results per page (max 100). |
Code samples for "Compare two commits"
Request example
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.unizo.ai/repos/{owner}/{repo}/compare/{base}...{head}Response
Status: 200
{
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"node_id": "MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ==",
"commit": {
"author": {
"name": "Monalisa Octocat",
"email": "support@github.com",
"date": "2011-04-14T16:00:49Z"
},
"committer": {
"name": "Monalisa Octocat",
"email": "support@github.com",
"date": "2011-04-14T16:00:49Z"
},
"message": "Fix all the bugs",
"tree": {
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e"
}
}
}Returns a list of branches for the specified repository.
Parameters
| Name | Type | Description |
|---|---|---|
integrationId* | string | The unique identifier of your integration. |
correlationId* | string | The unique ID used to trace and link related requests across systems. |
owner* | string | The account owner of the repository. |
repo* | string | The name of the repository without the .git extension. |
protected | boolean | Setting to true returns only branches that are protected. |
per_page | integer | The number of results per page (max 100). |
page | integer | The page number of the results to fetch. |
Code samples for "List branches"
Request example
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.unizo.ai/repos/{owner}/{repo}/branchesResponse
Status: 200
{
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"node_id": "MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ==",
"commit": {
"author": {
"name": "Monalisa Octocat",
"email": "support@github.com",
"date": "2011-04-14T16:00:49Z"
},
"committer": {
"name": "Monalisa Octocat",
"email": "support@github.com",
"date": "2011-04-14T16:00:49Z"
},
"message": "Fix all the bugs",
"tree": {
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e"
}
}
}Returns detailed information about a specific branch.
Parameters
| Name | Type | Description |
|---|---|---|
integrationId* | string | The unique identifier of your integration. |
correlationId* | string | The unique ID used to trace and link related requests across systems. |
owner* | string | The account owner of the repository. |
repo* | string | The name of the repository without the .git extension. |
branch* | string | The name of the branch. |
Code samples for "Get a branch"
Request example
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.unizo.ai/repos/{owner}/{repo}/branches/{branch}Response
Status: 200
{
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"node_id": "MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ==",
"commit": {
"author": {
"name": "Monalisa Octocat",
"email": "support@github.com",
"date": "2011-04-14T16:00:49Z"
},
"committer": {
"name": "Monalisa Octocat",
"email": "support@github.com",
"date": "2011-04-14T16:00:49Z"
},
"message": "Fix all the bugs",
"tree": {
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e"
}
}
}