Querying File Information of a Repository (Deprecated)
Function
Obtain file information in the repository, such as the name, size, and content. Note that the file content is encoded using Base64.
URI
GET /v2/projects/{repo_id}/repository/files/{file_path}
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
repo_id |
Yes |
Integer |
Repository short ID |
|
file_path |
Yes |
String |
Full path of the new URL-encoded file. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
ref |
Yes |
String |
Commit ID, which is the branch name or tag name of the repository. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
error |
Error object |
Response error |
|
result |
Array of FileContentInfo objects |
Difference list |
|
status |
String |
Explanation: Response status Range:
|
|
Parameter |
Type |
Description |
|---|---|---|
|
file_name |
String |
File name |
|
file_path |
String |
File path |
|
size |
Integer |
File size |
|
encoding |
String |
Document code |
|
content_sha256 |
String |
SHA256-encoded file content |
|
ref |
String |
Branch name. |
|
blob_id |
String |
Blob sha |
|
commit_id |
String |
SHA ID of a commit |
|
last_commit_id |
String |
SHA ID corresponding to the last commit |
|
content |
String |
Base64-encoded file content |
Request Example
GET https://{endpoint}/v2/projects/859341/repository/files/README%2Emd?ref=master
Response Example
Status code: 200
OK
{
"result" : [ {
"size" : 9,
"encoding" : "base64",
"ref" : "master",
"content" : "NDU0NTQ1NDQ1",
"file_name" : "README.md",
"file_path" : "README.md",
"content_sha256" : "e16f4f6c41a79d120484774a625bea8a3c3dcb655aa7c7e793ac48639dc63944",
"blob_id" : "3325fa3142fd66fedc8c3a5218b417f561e0ea2f",
"commit_id" : "a772945ec2765e322cc83e0f467f394effa22cf3",
"last_commit_id" : "a772945ec2765e322cc83e0f467f394effa22cf3"
} ],
"status" : "success"
}
Status Codes
|
Status Codes |
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
