Query Accounts

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

Queryable 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"
    }
  ]
}
NameTypeDescriptionStarting Version
successboolean 0.6
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error0.6
inventoriesListFor details, see inventories0.6

error

NameTypeDescriptionStarting Version
codeStringThe 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

inventories

NameTypeDescriptionStarting Version
uuidStringThe account UUID, uniquely identifying this resource4.0.0
nameStringAccount name4.0.0
descriptionStringDetailed description of the account4.0.0
typeStringAccount type4.0.0
stateStringAccount state4.0.0
createDateTimestampCreation time4.0.0
lastOpDateTimestampLast modification time4.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()