Create Account Group
Headers
Authorization: OAuth the-session-uuidBody
{
"params": {
"name": "my-group"
},
"systemTags": [],
"userTags": []
}In the example above, the systemTags and userTags fields are optional. They are listed to indicate that these two fields can be included in the body.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"my-group"}}' \
http://localhost:8080/zstack/v1/account-groupsParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | Account group name | 4.10.0 | |
| description (Optional) | String | body (contained in the params structure) | Detailed description of the account group | 4.10.0 | |
| parentUuid (Optional) | String | body (contained in the params structure) | Parent account group UUID | 4.10.0 | |
| resourceUuid (Optional) | String | body (contained in the params structure) | Predefined account group UUID | 4.10.0 | |
| tagUuids (Optional) | List | body (contained in the params structure) | Tag UUID list | 4.10.0 | |
| systemTags (Optional) | List | body | System tags | 4.10.0 | |
| userTags (Optional) | List | body | User tags | 4.10.0 |
API Response
Response example
{
"inventory": {
"uuid": "98cab5e804424603892af30a1f7a4a58",
"name": "my-group",
"description": "my-group-description",
"rootGroupUuid": "98cab5e804424603892af30a1f7a4a58",
"createDate": "Nov 14, 2017 2:20:57 PM",
"lastOpDate": "Nov 14, 2017 2:20:57 PM"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the request is successful | 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 |
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
CreateAccountGroupAction action = new CreateAccountGroupAction();
action.name = "my-group";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateAccountGroupAction.Result res = action.call();
Python SDK
CreateAccountGroupAction action = CreateAccountGroupAction()
action.name = "my-group"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateAccountGroupAction.Result res = action.call()