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.
URI
GET /v1/repositories/{repository_uuid}/branch/{branch_name}/file
|
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 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
path |
Yes |
String |
Explanation File path. Constraints None Range 0-200 Default value None |
Request Parameters
|
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
|
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
|
|
Parameter |
Type |
Description |
|---|---|---|
|
code |
String |
Explanation Error code. Range Max. 100 characters in the error code format. |
|
message |
String |
Explanation Error message. Range None |
|
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot
