Help Center/ CodeArts Repo/ API Reference/ APIs/ Repository/ Obtain files in the branch directory.
Updated on 2023-05-06 GMT+08:00

Obtain files in the branch directory.

Function

Obtain files in the branch directory.

URI

GET /v1/repositories/{repository_uuid}/branch/{branch_name}/sub-files

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

repository_uuid

Yes

String

Specifies the repository ID.

branch_name

Yes

String

Branch name.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

path

No

String

Path

offset

No

Integer

Offset

limit

No

Integer

Number of Records

Request Parameters

Table 3 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 4 Response body parameters

Parameter

Type

Description

error

Error object

Response error.

result

LogsTreeList object

Result

status

String

Response status.

Table 5 Error

Parameter

Type

Description

code

String

Error Codes

message

String

Error message

Table 6 LogsTreeList

Parameter

Type

Description

trees

Array of LogsTree objects

File Log Tree

total

Integer

By path limit

Table 7 LogsTree

Parameter

Type

Description

blob_id

String

Specifies the storage block ID.

commit

Commit object

Details

file_name

String

File Name

file_path

String

File path.

md5

String

MD5

type

String

Storage type

Table 8 Commit

Parameter

Type

Description

author_email

String

Author Email

author_name

String

Author

authored_date

String

Author Submission Time

committed_date

String

Submitted

committer_email

String

Submit Author Email

committer_name

String

Requester

format

Object

Details about the file change. The format is determined by the stat_format parameter.

id

String

Submit the corresponding SHA ID.

message

String

Submitted Information

parent_ids

Array of strings

Parent Submission ID

Example Requests

GET https://{endpoint}/v1/repositories/{repository_uuid}/branch/{branch_name}/sub-files

Example Responses

Status code: 200

OK

{
  "result" : {
    "trees" : [ {
      "blob_id" : "ef69ef5dc0c53022fe52a4d02de15f73d96e055c",
      "file_name" : "csharpDemo.png",
      "file_path" : "images/csharpDemo.png",
      "md5" : "8830d25fe6b4e2cd14d75ddb5cae73a7",
      "type" : "blob",
      "commit" : {
        "id" : "1cfd6d81fff948828c7f59bda74c0ef80e53def0",
        "message" : "init\n",
        "parent_ids" : [ ],
        "author_name" : "repo",
        "author_email" : "repo@huawei.com",
        "committed_date" : "2019-11-13 11:29:26",
        "committer_name" : "repo",
        "committer_email" : "repo@huawei.com"
      }
    } ],
    "total" : 5
  },
  "status" : "success"
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.