Updated on 2026-01-27 GMT+08:00

Querying Branches of a Repository (Deprecated)

Function

This API is used to query the branch list of a specified repository by the repository ID.

The current API has been deprecated. Use the API described in Obtaining the Branch List instead.

URI

GET /v1/repositories/{repository_id}/branches

Table 1 Path parameters

Parameter

Mandatory

Type

Description

repository_id

Yes

String

Repository ID.

Request Parameters

Table 2 Request header parameter

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Explanation

User token. It can be obtained by calling the corresponding IAM API. The value of X-Subject-Token in the response header is the user token.

Constraints

Mandatory

Range

1–100,000 characters.

Default value

None.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

error

Error object

Response error.

result

BranchList object

Response result.

status

String

Explanation

Response status.

Range

  • success: The API call is successful.
  • failed: The API call failed.
Table 4 Error

Parameter

Type

Description

code

String

Error code.

message

String

Error message.

Table 5 BranchList

Parameter

Type

Description

branches

Array of Branch objects

Branch list of a specified repository.

total

Integer

Total number of branches in a specified repository.

Table 6 Branch

Parameter

Type

Description

is_protected

Boolean

Whether to protect the branch.

name

String

Branch name.

Example Requests

GET https://{endpoint}/v1/repositories/{repository_id}/branches

Example Responses

Status code: 200

OK

{
  "result" : {
    "total" : 1,
    "branches" : [ {
      "name" : "master",
      "is_protected" : false
    } ]
  },
  "status" : "success"
}

Status Code

Status Code

Description

200

OK

Error Codes

See Error Codes.