Help Center/ CodeArts Repo/ API Reference/ APIs/ Repository/ Obtaining the Content of a Specified File in a Specified Branch of a Repository
Updated on 2026-01-27 GMT+08:00

Obtaining the Content of a Specified File in a Specified Branch of a Repository

Function

This API is used to obtain the content of a specified file in a specified branch of a repository.

This API has been deprecated. Use the API described in Viewing File Attributes and Content instead.

URI

GET /v1/repositories/{repository_uuid}/branch/{branch_name}/file

Table 1 Path parameters

Parameter

Mandatory

Type

Description

repository_uuid

Yes

String

Explanation

Repository UUID. For details, see the UUID returned by Querying the Details About a Repository.

Constraints

None

Range

32 digits and letters.

Default value

None

branch_name

Yes

String

Explanation

Branch name.

Constraints

None

Range

The branch name contains 0 to 200 characters.

Default value

None

Table 2 Query parameters

Parameter

Mandatory

Type

Description

path

Yes

String

Explanation

File path.

Constraints

None

Range

0-200

Default value

None

Request Parameters

Table 3 Request header parameter

Parameter

Mandatory

Type

Description

X-Auth-Token

No

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

None

Range

1–100,000 characters.

Default value

None

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

error

Error object

Explanation

Response error code.

Range

None

result

FilesResponseInfo object

Explanation

Response result.

Range

None

status

String

Explanation

Response status.

Range

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

Parameter

Type

Description

code

String

Explanation

Error code.

Range

Max. 100 characters in the error code format.

message

String

Explanation

Error message.

Range

None

Table 6 FilesResponseInfo

Parameter

Type

Description

file_name

String

Explanation

File name

Range

None

file_path

String

Explanation

File path.

Range

None

size

Integer

Explanation

File size.

Range

None

encoding

String

Explanation

Coding type.

Range

None

ref

String

Explanation

Branch or tag name.

Range

None

blob_id

String

Explanation

File block ID, which can be set based on the file.

Range

None

file_type

String

Explanation

File type.

Range

None

content

String

Explanation

File content.

Range

None

Example Requests

GET https://{endpoint}/v1/repositories/{repository_uuid}/branch/{branch_name}/file

Example Responses

Status code: 200

OK

{
  "result" : [ {
    "file_name" : "README.md",
    "file_path" : "README.md",
    "size" : 666,
    "encoding" : "base64",
    "ref" : "master",
    "blob_id" : "75c19b5b1904a72c8a9959c98ae6884d0ace0279",
    "file_type" : "text/plain; charset=utf-8",
    "content" : "RUVFRUVFRUU="
  } ],
  "status" : "success"
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.