Help Center> CodeArts Repo> API Reference> APIs> Repository> Querying the Branch of a Warehouse
Updated on 2023-09-12 GMT+08:00

Querying the Branch of a Warehouse

Function

This API is used to obtain the branch list of a specified repository based on the repository ID.

URI

GET /v1/repositories/{repository_id}/branches

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

repository_id

Yes

String

Primary key ID of a warehouse.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the user token.

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

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

error

Error object

Response error.

result

BranchList object

Result

status

String

Status code in a response

Table 4 Error

Parameter

Type

Description

code

String

Error Codes

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 enable the branch protection function

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 Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.