Description: Retrieve all the branches that belong to a specific repository.
Note: This API endpoint allows you to fetch all Git branches associated with a given repository identified by its repo_id.
Since: Xray version 3.122
Security: A user with READ permissions is required.
Usage: GET /xray/api/v1/git/repositories/{repository_id}/branches
Produces: application/json
Path Parameters
Name | Type | Required/Optional | Description |
|---|---|---|---|
| string | Required | The unique identifier of the repository for which you want to retrieve branches |
Query Parameters
Name | Type | Required/Optional | Description |
|---|---|---|---|
| integer | optional | The page number for pagination. Default: 1 |
| integer | optional | The number of results per page. Default: 50 |
| string | optional | Sort order by name or last_scanned_date |
| string | optional | The direction by which to order the results: asc or desc |
Response Codes
Name | Description |
|---|---|
| OK |
| Bad request: invalid parameters |
| Unauthorized |
| Forbidden |
| Not found: repository_id doesn't exist |
| Internal error |
Response Body
Name | Type | Description |
|---|---|---|
| integer | The current page number of the result set |
l | integer | The number of items returned per page |
| integer | The total number of branches available for the repository |
| integer | The unique identifier of the repository for which branches are being retrieved |
| string | The URL of the repository |
| string | The name of the repository |
| srray[branch] | An array of branch objects, each containing details about individual branches |
branch
Name | Type | Description |
|---|---|---|
| string | The name of the branch |
| string | The timestamp of the last scan on this branch, formatted in ISO 8601 |
| string | The hash of the last scanned commit for the branch |
| integer | The total number of commits scanned for this branch |
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",
"branches": [
{
"name": "main",
"last_scanned_commit": "8ba779e5",
"last_scanned_date": "2024-08-10T10:13:48Z",
"scanned_commits_count": 1
}
]
}