Query Custom Attribute Values

GET/zstack/v1/resource-attributes

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?q=keyUuid=ff03a2b491023030bf58b1b35ea9cd00

Queryable Fields

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

API Response

Response example

{
  "inventories": [
    {
      "keyUuid": "ff03a2b491023030bf58b1b35ea9cd00",
      "key": {
        "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"
          }
        ]
      },
      "value": "Kinny",
      "resourceUuid": "ff01ec80fd11327cba7519b66119d900",
      "resourceType": "VmInstanceVO",
      "createDate": "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
keyUuidStringCustom attribute key UUID4.10.16
valueStringValue4.10.16
resourceUuidStringResource UUID4.10.16
resourceTypeStringResource type4.10.16
createDateTimestampCreation time4.10.16
keyResourceAttributeKeyInventoryFor details, see key4.10.16

key

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

QueryResourceAttributeValueAction action = new QueryResourceAttributeValueAction();
action.conditions = asList("keyUuid=ff03a2b491023030bf58b1b35ea9cd00");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryResourceAttributeValueAction.Result res = action.call();

Python SDK

action = QueryResourceAttributeValueAction()
action.conditions = ["keyUuid=ff03a2b491023030bf58b1b35ea9cd00"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()