Get Accounts in Account Group

GET/zstack/v1/account-groups/tree

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/tree?groupUuid=470ce4d7a8dc32f597aa77675da3cd08&level=0&showGroup=true&showAccount=true

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
groupUuid (Optional)StringqueryAccount group UUID. null means querying all top-level account groups 4.10.0
level (Optional)intqueryDepth to query sub-account groups downward. Default is 0, meaning sub-account groups' accounts and groups are not queried. 1 means querying accounts and groups under sub-account groups 4.10.0
showGroup (Optional)booleanqueryWhether the result includes account group information. Default is true 4.10.0
showAccount (Optional)booleanqueryWhether the result includes account information. Default is true 4.10.0
systemTags (Optional)ListquerySystem tags 4.10.0
userTags (Optional)ListqueryUser tags 4.10.0

API Response

Response example

{
  "inventory": {
    "groupUuid": "5fdbee64b1944837a7a09f12fed57fec",
    "groupName": "my-group",
    "inventory": {
      "uuid": "5fdbee64b1944837a7a09f12fed57fec",
      "name": "my-group",
      "description": "my-group-description",
      "rootGroupUuid": "5fdbee64b1944837a7a09f12fed57fec",
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    },
    "accounts": [
      {
        "uuid": "6a31cfb1bdf8422aa78b38bc6f65a199",
        "name": "account1",
        "description": "account1-description",
        "type": "Normal",
        "state": "Enabled",
        "createDate": "Nov 14, 2017 2:20:57 PM",
        "lastOpDate": "Nov 14, 2017 2:20:57 PM"
      }
    ],
    "groups": [
      {
        "groupUuid": "cc6ed770ad4c4ec3a229ca8fd2d4e223",
        "groupName": "child-group",
        "accounts": [],
        "groups": []
      }
    ]
  }
}
NameTypeDescriptionStarting Version
successbooleanWhether the request is successful4.10.0
inventoriesListFor details, see inventories4.10.0
errorErrorCodeError code. If not null, the operation failed. This field is null on success. For details, see error4.10.0

inventories

NameTypeDescriptionStarting Version
uuidStringThe UUID of the account, 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

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

SDK Examples

Java SDK

GetAccountGroupTreeAction action = new GetAccountGroupTreeAction();
action.groupUuid = "470ce4d7a8dc32f597aa77675da3cd08";
action.level = 0;
action.showGroup = true;
action.showAccount = true;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetAccountGroupTreeAction.Result res = action.call();

Python SDK

GetAccountGroupTreeAction action = GetAccountGroupTreeAction()
action.groupUuid = "470ce4d7a8dc32f597aa77675da3cd08"
action.level = 0
action.showGroup = true
action.showAccount = true
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetAccountGroupTreeAction.Result res = action.call()