Listing Files in a Directory
Function
List files in a directory on the storage.
URI
GET Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/{connector_type}/{connector_name}/listdir?dir=path&max-keys=A&marker=B
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
connector_type |
Yes |
String |
Explanation Type of a connector. Constraints None Value
Default value None |
connector_name |
Yes |
String |
Explanation Name of the connector instance, that is, the connector instance name set when the connector is created. Constraints None Value None Default value None |
dir |
Yes |
String |
Explanation Directory to be listed. If the directory is empty or /, the root directory is listed. Constraints None Value None Default value None |
max-keys |
No |
Number |
Explanation Maximum number of files that can be accessed. The maximum value is 1000. The default value is 1000. Constraints None Value None Default value None |
marker |
No |
String |
Explanation File at the access start. Note that the file is not included in the returned result, and the file must be of a full path, that is, a directory is included. If this parameter is not specified, it starts from the beginning. Example: marker=a/b/c/1.txt. Constraints None Value None Default value None |
Request Parameters
None
Response Parameters
Parameter |
Type |
Description |
---|---|---|
resCode |
String |
Explanation Return code. Value If the request is successful, 0 is returned. For details about other error codes, see Error Codes. |
resMsg |
String |
Explanation Message returned. Value If the request is successful, "Success" is returned. In other cases, an error message is returned. |
result |
Array of object |
Explanation The file list of the directory is returned. The fields in the list are described as follows:
|
Example Request
An OBS connector has been created. The connector instance name is Namespace __TestOBS. Run the following request to list files in the a/b/c path of the OBS bucket. The start file is 1.txt.
GET https://Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/obs/Namespace __TestOBS/listdir?dir=a/b/c&max-keys=1000&marker=a/b/c/1.txt
Example Response
{ "resCode": "0", "resMsg": "Success", "result": [{ "name": "test.zip", "isDir": false, "size": 833154 }, { "name": "image_20201220181511.png", "isDir": false, "size": 78530 }, { "name": "monthly summary.txt", "isDir": false, "size": 824 } ] }
Status Code
See Status Codes.
Error Code
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