Create Account Group

POST/zstack/v1/account-groups

Headers

Authorization: OAuth the-session-uuid

Body

{
  "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-groups

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
nameStringbody (contained in the params structure)Account group name 4.10.0
description (Optional)Stringbody (contained in the params structure)Detailed description of the account group 4.10.0
parentUuid (Optional)Stringbody (contained in the params structure)Parent account group UUID 4.10.0
resourceUuid (Optional)Stringbody (contained in the params structure)Predefined account group UUID 4.10.0
tagUuids (Optional)Listbody (contained in the params structure)Tag UUID list 4.10.0
systemTags (Optional)ListbodySystem tags 4.10.0
userTags (Optional)ListbodyUser 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"
  }
}
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

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

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()