Query Account Group

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

Queryable Fields

Run the CLI tool, type QueryAccountGroup, and press Tab to view all queryable fields and cross-table queryable resource names.

API Response

Response example

{
  "inventories": [
    {
      "uuid": "c7e4d70aa27b49839516c7ed9d3651a8",
      "name": "my-group",
      "description": "my-group-description",
      "rootGroupUuid": "c7e4d70aa27b49839516c7ed9d3651a8",
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    }
  ]
}
NameTypeDescriptionStarting Version
successbooleanWhether the request is successful4.10.0
errorErrorCodeError code. If not null, the operation failed. This field is null on success. For details, see error4.10.0
inventoriesListFor details, see inventories4.10.0

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
detailsStringDetailed information about the error0.6
elaborationStringReserved field. Default is null0.6
opaqueLinkedHashMapReserved field. Default is null0.6
causeErrorCodeThe root error that caused the current error. This field is null if there is no root cause0.6

inventories

NameTypeDescriptionStarting Version
uuidStringThe UUID of the account group, uniquely identifying this resource4.10.0
nameStringAccount group name4.10.0
descriptionStringDetailed description of the account group4.10.0
parentUuidStringParent account group UUID. null means no parent account group; it is the top-level group4.10.0
rootGroupUuidStringThe UUID of the top-level account group. If this is the top-level group, rootGroupUuid points to itself4.10.0
createDateTimestampCreation time4.10.0
lastOpDateTimestampLast modification time4.10.0

SDK Examples

Java SDK

QueryAccountGroupAction action = new QueryAccountGroupAction();
action.conditions = asList("name=my-group");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAccountGroupAction.Result res = action.call();

Python SDK

QueryAccountGroupAction action = QueryAccountGroupAction()
action.conditions = ["name=my-group"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAccountGroupAction.Result res = action.call()