Skip to main content

REST API endpoints for commits

Use the REST API to interact with commits.

List commits

Returns a list of commits for the specified repository. You can use query parameters to filter and paginate the results.

Parameters

NameTypeDescription
integrationId*stringThe unique identifier of your integration. This is used to track API usage and billing.
correlationId*stringThe unique ID used to trace and link related requests across systems for debugging and monitoring.
owner*stringThe account owner of the repository. The name is not case sensitive.
repo*stringThe name of the repository without the .git extension. The name is not case sensitive.
shastringSHA or branch to start listing commits from. Default: the repository default branch (usually main).
pathstringOnly commits containing this file path will be returned.
authorstringGitHub username or email address to use to filter by commit author.
committerstringGitHub username or email address to use to filter by commit committer.
sincestringOnly show results that were last updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
untilstringOnly commits before this date will be returned. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pageintegerThe 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}/commits

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"
    }
  }
}

Get a commit

Returns the contents of a single commit reference. You must have read access for the repository to use this endpoint.

Parameters

NameTypeDescription
integrationId*stringThe unique identifier of your integration.
correlationId*stringThe unique ID used to trace and link related requests across systems.
owner*stringThe account owner of the repository.
repo*stringThe name of the repository without the .git extension.
ref*stringThe 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"
    }
  }
}

Compare two commits

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

NameTypeDescription
integrationId*stringThe unique identifier of your integration.
correlationId*stringThe unique ID used to trace and link related requests across systems.
owner*stringThe account owner of the repository.
repo*stringThe name of the repository without the .git extension.
base*stringThe base branch, tag, or SHA to use in the comparison.
head*stringThe head branch, tag, or SHA to use in the comparison.
pageintegerThe page number of the results to fetch.
per_pageintegerThe 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"
    }
  }
}

List branches

Returns a list of branches for the specified repository.

Parameters

NameTypeDescription
integrationId*stringThe unique identifier of your integration.
correlationId*stringThe unique ID used to trace and link related requests across systems.
owner*stringThe account owner of the repository.
repo*stringThe name of the repository without the .git extension.
protectedbooleanSetting to true returns only branches that are protected.
per_pageintegerThe number of results per page (max 100).
pageintegerThe 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}/branches

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"
    }
  }
}

Get a branch

Returns detailed information about a specific branch.

Parameters

NameTypeDescription
integrationId*stringThe unique identifier of your integration.
correlationId*stringThe unique ID used to trace and link related requests across systems.
owner*stringThe account owner of the repository.
repo*stringThe name of the repository without the .git extension.
branch*stringThe 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"
    }
  }
}