Query Custom Attribute Values
Headers
Authorization: OAuth the-session-uuidCurl 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=ff03a2b491023030bf58b1b35ea9cd00Queryable 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"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the query succeeded | 4.10.16 |
| inventories | List | For details, see inventories | 4.10.16 |
| error | ErrorCode | For details, see error | 4.10.16 |
inventories
| Name | Type | Description | Starting Version |
|---|---|---|---|
| keyUuid | String | Custom attribute key UUID | 4.10.16 |
| value | String | Value | 4.10.16 |
| resourceUuid | String | Resource UUID | 4.10.16 |
| resourceType | String | Resource type | 4.10.16 |
| createDate | Timestamp | Creation time | 4.10.16 |
| key | ResourceAttributeKeyInventory | For details, see key | 4.10.16 |
key
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Custom attribute key UUID | 4.10.16 |
| name | String | Custom attribute key name | 4.10.16 |
| description | String | Detailed description of the resource | 4.10.16 |
| createDate | Timestamp | Creation time | 4.10.16 |
| lastOpDate | Timestamp | Last modification time | 4.10.16 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| ode | String | The error code number, a globally unique identifier for the error, e.g., SYS.1000, HOST.1001 | 0.6 |
| description | String | A brief description of the error | 0.6 |
| details | String | The detailed error information | 0.6 |
| elaboration | String | Reserved field. Defaults to null | 0.6 |
| opaque | LinkedHashMap | Reserved field. Defaults to null | 0.6 |
| cause | ErrorCode | The root error, the cause of the current error. This field is null if there is no root error | 0.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()