Get Commits for a Branch

Xray REST APIs

Products
JFrog Xray
Content Type
REST API

Description: Retrieve all the commits that were scanned for a specific branch within a repository. 

Note: This API endpoint allows you to fetch comprehensive details about all the commits associated with a specified branch (branch_name) of a given repository (repository_id).

Since: Xray version 3.122

Security: A user with READ permissions is required.

Usage: GET /xray/api/v1/git-public/repositories/{repo_id}/commits

Produces: application/json

Path Parameters

Name

Type

Required/Optional

Description

repository_id

string

Required

The unique identifier of the repository

Query Parameters

Name

Type

Required/Optional

Description

page

integer

Optioanl

The page number for pagination. Default: 1

limit

integer

Optioanl

The number of results per page. Default: 50

order_by

string

Optioanl

Sort order by author or last_scanned_date

direction

string

Optioanl

The direction by which to order the results: asc or desc

branch_name

string

Required

The name of the branch for which you want to retrieve commits

Response Codes

Name

Description

200

OK

400

Bad request: invalid parameters

401

Unauthorized

403

Forbidden

500

Internal error

Response Body

Name

Type

Description

page

integer

The current page number of the result set

llimit

integer

The number of items returned per page

total_count

integer

The total number of commits available for the specified branch

repository_id

integer

The unique identifier of the repository

repository_url

string

The URL of the repository

repository_name

string

The name of the repository

branch_name

string

The name of the branch for which commits are being retrieved

commits

array[commit]

An array of commit objects, each containing details about individual commits

commit

Name

Type

Description

hash

string

The hash of the commit

author

string

The name of the author of the commit

scan_date

string

The timestamp of when the commit was scanned, formatted in ISO 8601

commit_message

string

The message associated with the commit

Successful Response Example

{
  "page": 1,
  "limit": 10,
  "total_count": 1,
  "repository_id": 12,
  "repository_url": "https://git.jfrog.info/projects/XSC/repos/xsc-service",
  "repository_name": "xsc-service",
  "branch_name": "main",
  "commits": [
    {
      "hash": "8ba779e5",
      "author": "JFrog the Frog",
      "scan_date": "2024-08-10T10:13:48Z",
      "commit_message": "This is my commit message"
    }
  ]
}