Query Custom Attribute Keys

GET/zstack/v1/resource-attributes/keys
GET/zstack/v1/resource-attributes/keys/{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/resource-attributes/keys?q=name=OperationsPersonnel
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/resource-attributes/keys/dbd98db0aeb939c38a6574e64b822b7d

Queryable Fields

Run the CLI tool, enter QueryResourceAttributeKey and press the Tab key to view all queryable fields and cross-table queryable resource names.

API Response

Response example

{
  "inventories": [
    {
      "uuid": "ff03a2b491023030bf58b1b35ea9cd00",
      "name": "OperationsPersonnel",
      "description": "Kinny",
      "resourceTypes": [
        "VmInstanceVO"
      ],
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM",
      "constraints": [
        {
          "id": 1,
          "keyUuid": "ff03a2b491023030bf58b1b35ea9cd00",
          "type": "option",
          "parameter": "Kinny",
          "createDate": "Nov 14, 2017 2:20:57 PM",
          "lastOpDate": "Nov 14, 2017 2:20:57 PM"
        }
      ]
    }
  ]
}
NameTypeDescriptionStarting Version
successbooleanWhether the query succeeded4.10.16
inventoriesListFor details, see inventories4.10.16
errorErrorCodeFor details, see error4.10.16

inventories

NameTypeDescriptionStarting Version
uuidStringCustom attribute key UUID4.10.16
nameStringCustom attribute key name4.10.16
descriptionStringDetailed description of the resource4.10.16
createDateTimestampCreation time4.10.16
lastOpDateTimestampLast modification time4.10.16

error

NameTypeDescriptionStarting Version
odeStringThe error code number, a globally unique identifier for the error, e.g., SYS.1000, HOST.10010.6
descriptionStringA brief description of the error0.6
detailsStringThe detailed error information0.6
elaborationStringReserved field. Defaults to null0.6
opaqueLinkedHashMapReserved field. Defaults to null0.6
causeErrorCodeThe root error, the cause of the current error. This field is null if there is no root error0.6

SDK Examples

Java SDK

QueryResourceAttributeKeyAction action = new QueryResourceAttributeKeyAction();
action.conditions = asList("name=OperationsPersonnel");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryResourceAttributeKeyAction.Result res = action.call();

Python SDK

action = QueryResourceAttributeKeyAction()
action.conditions = ["name=OperationsPersonnel"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()