Query Accounts
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/accounts?q=name=testcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/accounts/fa37d4ea030937b797cb97b2ea09840bQueryable Fields
Run the CLI tool, enter QueryAccount and press the Tab key to view all queryable fields and cross-table queryable resource names.
API Response
Response example
{
"inventories": [
{
"uuid": "5c4b1e96b2833c2db31c5d7f175c817d",
"name": "test",
"type": "Normal"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 0.6 | |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 0.6 |
| inventories | List | For details, see inventories | 0.6 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | 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 |
inventories
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The account UUID, uniquely identifying this resource | 4.0.0 |
| name | String | Account name | 4.0.0 |
| description | String | Detailed description of the account | 4.0.0 |
| type | String | Account type | 4.0.0 |
| state | String | Account state | 4.0.0 |
| createDate | Timestamp | Creation time | 4.0.0 |
| lastOpDate | Timestamp | Last modification time | 4.0.0 |
SDK Examples
Java SDK
QueryAccountAction action = new QueryAccountAction();
action.conditions = asList("name=test");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAccountAction.Result res = action.call();
Python SDK
QueryAccountAction action = QueryAccountAction()
action.conditions = ["name=test"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAccountAction.Result res = action.call()