Get Accounts in Account Group
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/account-groups/tree?groupUuid=470ce4d7a8dc32f597aa77675da3cd08&level=0&showGroup=true&showAccount=trueParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| groupUuid (Optional) | String | query | Account group UUID. null means querying all top-level account groups | 4.10.0 | |
| level (Optional) | int | query | Depth 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) | boolean | query | Whether the result includes account group information. Default is true | 4.10.0 | |
| showAccount (Optional) | boolean | query | Whether the result includes account information. Default is true | 4.10.0 | |
| systemTags (Optional) | List | query | System tags | 4.10.0 | |
| userTags (Optional) | List | query | User 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": []
}
]
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the request is successful | 4.10.0 |
| inventories | List | For details, see inventories | 4.10.0 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null on success. For details, see error | 4.10.0 |
inventories
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the account, 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 |
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 | Detailed information about the error | 0.6 |
| elaboration | String | Reserved field. Default is null | 0.6 |
| opaque | LinkedHashMap | Reserved field. Default is null | 0.6 |
| cause | ErrorCode | The root error that caused the current error. This field is null if there is no root cause | 0.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()