QueryDirectory
API Request
URLs
GET zstack/v1/directories
GET zstack/v1/directories/{uuid}Headers
Authorization: OAuth the-session-uuidCurl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/directories?q=uuid=39b8a9d8cb2e32b893bd82c5c2be7e24curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/directories/4cfe730d431f3550994064911c1c6e0eQueryable Fields
You can check all queryable fields and resource names that can be queried across
tables by using zstack-cli, entering
QueryDirectory, and pressing the Tab key.
API Response
Sample
Response
{
"inventories": [
{
"uuid": "b3c48edddae03e05b328a5b0926ae353",
"name": "test",
"groupName": "admin/test",
"parentUuid": "d0dc05fcf5753c6888d0b082bc0f9caf",
"rootDirectoryUuid": "3830935ca3823d05b9010f242139fad4",
"zoneUuid": "0f7266aa26f339cb8f0b47a73d0ddc30",
"type": "vminstance"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | Boolean | 5.3.20 | |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 5.3.20 |
| inventories | List | Seeinventories. | 5.3.20 |
#inventories
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 5.3.20 |
| name | String | The resource name. | 5.3.20 |
| groupName | String | The group name. | 5.3.20 |
| parentUuid | String | The parent directory UUID. | 5.3.20 |
| rootDirectoryUuid | String | The root directory UUID. | 5.3.20 |
| zoneUuid | String | The zone UUID. | 5.3.20 |
| type | String | The directory type. | 5.3.20 |
| createDate | Timestamp | The creation time. | 5.3.20 |
| lastOpDate | Timestamp | The last operation time. | 5.3.20 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 5.3.20 |
| description | String | The brief description of the error. | 5.3.20 |
| details | String | The details about the error. | 5.3.20 |
| elaboration | String | The reserved field. Default value: null. | 5.3.20 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 5.3.20 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 5.3.20 |
SDK Sample
Java
SDK
QueryDirectoryAction action = new QueryDirectoryAction();
action.conditions = asList("uuid=b07055c553733af095d0714456157626");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryDirectoryAction.Result res = action.call();Python
SDK
QueryDirectoryAction action = QueryDirectoryAction()
action.conditions = ["uuid=e38b6311766c3f88ab31c2d02db4e58f"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryDirectoryAction.Result res = action.call()