VM Related Interfaces

Query Directory

GET/zstack/v1/directories
GET/zstack/v1/directories/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/directories?q=uuid=39b8a9d8cb2e32b893bd82c5c2be7e24
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/directories/4cfe730d431f3550994064911c1c6e0e

Queryable Fields

Run the CLI tool, type QueryDirectory and press Tab to view all queryable fields and cross-table queryable resource names.

API Response

Response Example

{
  "inventories": [
    {
      "uuid": "b3c48edddae03e05b328a5b0926ae353",
      "name": "test",
      "groupName": "admin/test",
      "parentUuid": "d0dc05fcf5753c6888d0b082bc0f9caf",
      "rootDirectoryUuid": "3830935ca3823d05b9010f242139fad4",
      "zoneUuid": "0f7266aa26f339cb8f0b47a73d0ddc30",
      "type": "vminstance"
    }
  ]
}
NameTypeDescriptionStarting Version
successboolean 4.7.0
inventoriesListFor details, see inventories4.7.0
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error4.7.0

inventories

NameTypeDescriptionStarting Version
uuidStringUUID of the resource. Uniquely identifies the resource.4.6.0
nameStringResource name4.6.0
groupNameStringGroup it belongs to4.6.0
parentUuidStringParent directory UUID4.6.0
rootDirectoryUuidStringRoot directory UUID4.6.0
zoneUuidStringData Center UUID4.6.0
typeStringDirectory type4.6.0
createDateTimestampCreation time4.6.0
lastOpDateTimestampLast modification time4.6.0

error

NameTypeDescriptionStarting Version
codeStringError code number. A globally unique identifier for the error, e.g., SYS.1000, HOST.1001.0.6
descriptionStringBrief description of the error0.6
detailsStringDetailed information about the error0.6
elaborationStringReserved field. Defaults to null.0.6
opaqueLinkedHashMapReserved field. Defaults to null.0.6
causeErrorCodeRoot error. The source error that caused the current error. This field is null if there is no root cause.0.6

SDK Examples

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()