User Configuration
CreateAccount
Create Account
API Request
POST zstack/v1/accounts
Authorization: OAuth the-session-uuid
{
"params": {
"name": "test",
"password": "password",
"state": "Enabled"
},
"systemTags": [],
"userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown to indicate that the body can contain these two fields.curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X POST -d '{"params":{"name":"test","password":"password","state":"Enabled"}}' http://localhost:8080/zstack/v1/accounts
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| name | String | body (included in the params structure) |
Resource name | 0.6 | |
| password | String | body (included in the params structure) |
Password | 0.6 | |
| type (Optional) | String | body (included in the params structure) |
Account type |
|
0.6 |
| description (Optional) | String | body (included in the params structure) |
Detailed resource description | 0.6 | |
| resourceUuid (Optional) | String | body (included in the params structure) |
Resource UUID | 0.6 | |
| systemTags (Optional) | List | body | System tags | 0.6 | |
| userTags (Optional) | List | body | User tags | 0.6 | |
| tagUuids (Optional) | List | body (included in the params structure) |
Tag UUID list | 3.4.0 | |
| state (Optional) | String | body (included in the params structure) |
Account state |
|
4.3.0 |
API Response
{
"inventory": {
"uuid": "77dc15220f71377ea48fa520d40d9169",
"name": "test",
"type": "Normal"
}
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 0.6 |
| error | ErrorCode | Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error | 0.6 |
| inventory | AccountInventory | For details, see inventory | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 | 0.6 |
| description | String | Summary description of the error | 0.6 |
| details | String | Details of the error | 0.6 |
| elaboration | String | Reserved field. The default value is null | 0.6 |
| opaque | LinkedHashMap | Reserved field. The default value is null | 0.6 |
| cause | ErrorCode | Root error that caused the current error. This field is null if there is no source error | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The account UUID, 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 |
| source | String | Account source, which is determined at creation and cannot be modified | 5.1.0 |
| state | String | Account state | 4.0.0 |
| createDate | Timestamp | Creation time | 4.0.0 |
| lastOpDate | Timestamp | Last modification time | 4.0.0 |
SDK Examples
CreateAccountAction action = new CreateAccountAction();
action.name = "test";
action.password = "password";
action.state = "Enabled";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateAccountAction.Result res = action.call();
action = CreateAccountAction()
action.name = "test"
action.password = "password"
action.state = "Enabled"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()
DeleteAccount
API Request
DELETE zstack/v1/accounts/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/accounts/0f4d2956d5ef35fc9c51ca45b09ba2bb| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID, uniquely identifying this resource | 0.6 | |
| deleteMode (optional) | String | body | Deletion mode | 0.6 | |
| systemTags (optional) | List | body | System tags | 0.6 | |
| userTags (optional) | List | body | User tags | 0.6 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Examples
DeleteAccountAction action = new DeleteAccountAction();
action.uuid = "0f4d2956d5ef35fc9c51ca45b09ba2bb";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteAccountAction.Result res = action.call();DeleteAccountAction action = DeleteAccountAction()
action.uuid = "0f4d2956d5ef35fc9c51ca45b09ba2bb"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteAccountAction.Result res = action.call()UpdateAccount
Update Account
API Request
PUT zstack/v1/accounts/{uuid}
Authorization: OAuth the-session-uuid
{
"updateAccount": {
"password": "updatepassword",
"name": "updatename"
},
"systemTags": [],
"userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown to indicate that the body can contain these two fields.curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X PUT -d '{"updateAccount":{"password":"updatepassword","name":"updatename"}}' http://localhost:8080/zstack/v1/accounts/99fcb2ad540c36f09e87c820ac6cb4cb
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | Resource UUID, which uniquely identifies the resource | 0.6 | |
| password (Optional) | String | body (included in the updateAccount structure) |
Password | 0.6 | |
| name (Optional) | String | body (included in the updateAccount structure) |
Account name | 0.6 | |
| description (Optional) | String | body (included in the updateAccount structure) |
Detailed resource description | 0.6 | |
| systemTags (Optional) | List | body | System tags | 0.6 | |
| userTags (Optional) | List | body | User tags | 0.6 | |
| oldPassword (Optional) | String | body (included in the updateAccount structure) |
Original password | 3.6.0 | |
| state (Optional) | String | body (included in the updateAccount structure) |
Account state |
|
4.3.0 |
API Response
{
"inventory": {
"uuid": "ffbf2fac53b83b838d4551edcaff1d39",
"name": "test",
"type": "Normal"
}
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 0.6 |
| error | ErrorCode | Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error | 0.6 |
| inventory | AccountInventory | For details, see inventory | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 | 0.6 |
| description | String | Summary description of the error | 0.6 |
| details | String | Details of the error | 0.6 |
| elaboration | String | Reserved field. The default value is null | 0.6 |
| opaque | LinkedHashMap | Reserved field. The default value is null | 0.6 |
| cause | ErrorCode | Root error that caused the current error. This field is null if there is no source error | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The account UUID, 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 |
| source | String | Account source, which is determined at creation and cannot be modified | 5.1.0 |
| state | String | Account state | 4.0.0 |
| createDate | Timestamp | Creation time | 4.0.0 |
| lastOpDate | Timestamp | Last modification time | 4.0.0 |
SDK Examples
UpdateAccountAction action = new UpdateAccountAction();
action.uuid = "99fcb2ad540c36f09e87c820ac6cb4cb";
action.password = "updatepassword";
action.name = "updatename";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateAccountAction.Result res = action.call();
action = UpdateAccountAction()
action.uuid = "99fcb2ad540c36f09e87c820ac6cb4cb"
action.password = "updatepassword"
action.name = "updatename"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()
QueryAccount
Query Account
API Request
GET zstack/v1/accounts
GET zstack/v1/accounts/{uuid}
Authorization: OAuth the-session-uuid
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X GET http://localhost:8080/zstack/v1/accounts?q=name=test
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X GET http://localhost:8080/zstack/v1/accounts/fa37d4ea030937b797cb97b2ea09840b
Queryable Fields
Run the CLI tool and enter QueryAccount, and press Tab to view all queryable fields and the names of resources available for cross-table queries.
API Response
{
"inventories": [
{
"uuid": "5c4b1e96b2833c2db31c5d7f175c817d",
"name": "test",
"type": "Normal"
}
]
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 0.6 |
| error | ErrorCode | Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error | 0.6 |
| inventories | List | For details, see inventories | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 | 0.6 |
| description | String | Summary description of the error | 0.6 |
| details | String | Details of the error | 0.6 |
| elaboration | String | Reserved field. The default value is null | 0.6 |
| opaque | LinkedHashMap | Reserved field. The default value is null | 0.6 |
| cause | ErrorCode | Root error that caused the current error. This field is null if there is no source error | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The account UUID, 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 |
| source | String | Account source, which is determined at creation and cannot be modified | 5.1.0 |
| state | String | Account state | 4.0.0 |
| createDate | Timestamp | Creation time | 4.0.0 |
| lastOpDate | Timestamp | Last modification time | 4.0.0 |
SDK Examples
QueryAccountAction action = new QueryAccountAction();
action.conditions = asList("name=test");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAccountAction.Result res = action.call();
action = QueryAccountAction()
action.conditions = ["name=test"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()
LogInByAccount
API Request
PUT zstack/v1/accounts/login{
"logInByAccount": {
"accountName": "test",
"password": "password",
"captchaUuid": "39bd748906ad301793c64f688dc197a9",
"verifyCode": "test"
},
"systemTags": [],
"userTags": []
}
Note: In the above example, the systemTags and userTags fields can be omitted. They are listed to show that these two fields can be included in the body.curl -H "Content-Type: application/json;charset=UTF-8" \
-X PUT -d '{"logInByAccount":{"accountName":"test","password":"password","captchaUuid":"39bd748906ad301793c64f688dc197a9","verifyCode":"test"}}' \
http://localhost:8080/zstack/v1/accounts/login| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| accountName | String | body (contained in the logInByAccount structure) | Account name | 0.6 | |
| password | String | body (contained in the logInByAccount structure) | Password | 0.6 | |
| captchaUuid (optional) | String | body (contained in the logInByAccount structure) | Captcha UUID | 2.6.0 | |
| verifyCode (optional) | String | body (contained in the logInByAccount structure) | Verification code | 2.6.0 | |
| clientInfo (optional) | Map | body (contained in the logInByAccount structure) | Client information | 3.5.0 | |
| systemTags (optional) | List | body | System tags | 0.6 | |
| userTags (optional) | List | body | User tags | 0.6 | |
| accountType (optional) | String | body (contained in the logInByAccount structure) |
Optional. The account type. | 3.4.0 |
API Response
{
"inventory": {
"uuid": "5d77893e242d39ec8b9856a7b8762eab",
"accountUuid": "7ab57f322e4a396b8124ed4fda810966",
"expiredDate": "Nov 14, 2017 2:20:57 PM",
"noSessionEvaluation": false
}
}| 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 | The detailed error information | 0.6 |
| elaboration | String | Reserved field. Defaults to null | 0.6 |
| opaque | LinkedHashMap | Reserved field. Defaults to null | 0.6 |
| cause | ErrorCode | The root error, the cause of the current error. This field is null if there is no root error | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID, uniquely identifying this resource | 0.6 |
| accountUuid | String | Account UUID | 0.6 |
| userUuid | String | User UUID | 0.6 |
| expiredDate | Timestamp | Session expiration date | 0.6 |
| createDate | Timestamp | Creation time | 0.6 |
SDK Examples
LogInByAccountAction action = new LogInByAccountAction();
action.accountName = "test";
action.password = "password";
action.captchaUuid = "39bd748906ad301793c64f688dc197a9";
action.verifyCode = "test";
LogInByAccountAction.Result res = action.call();
LogInByAccountAction action = LogInByAccountAction()
action.accountName = "test"
action.password = "password"
action.captchaUuid = "39bd748906ad301793c64f688dc197a9"
action.verifyCode = "test"
LogInByAccountAction.Result res = action.call()
CreateSessionForZCenterAccount
Create Session For Z Center Account
API Request
POST zstack/v1/zcenter/accounts/sessions
Authorization: OAuth the-session-uuid
{
"params": {
"accountName": "test1",
"source": "Local"
},
"systemTags": [],
"userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown to indicate that the body can contain these two fields.curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X POST -d '{"params":{"accountName":"test1","source":"Local"}}' http://localhost:8080/zstack/v1/zcenter/accounts/sessions
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| accountUuid (Optional) | String | body (included in the params structure) |
Account UUID | 5.1.0 | |
| accountName (Optional) | String | body (included in the params structure) |
Account name | 5.1.0 | |
| source (Optional) | String | body (included in the params structure) |
Account source |
|
5.1.0 |
| systemTags (Optional) | List | body | System tags | 5.1.0 | |
| userTags (Optional) | List | body | User tags | 5.1.0 |
API Response
{
"inventory": {
"uuid": "ff06305f62fd3b17a7e2c67628a08700",
"accountUuid": "ff0b33166633399aae77ea258d2f7900",
"expiredDate": "Nov 15, 2017 2:20:57 PM",
"createDate": "Nov 14, 2017 2:20:57 PM",
"noSessionEvaluation": false
}
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the creation succeeded | 5.1.0 |
| inventory | SessionInventory | For details, see inventory | 5.1.0 |
| error | ErrorCode | For details, see error | 5.1.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID, which uniquely identifies the resource | 0.6 |
| accountUuid | String | Account UUID | 0.6 |
| userUuid | String | User UUID | 0.6 |
| expiredDate | Timestamp | The expired date. | 0.6 |
| createDate | Timestamp | Creation time | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 | 0.6 |
| description | String | Summary description of the error | 0.6 |
| details | String | Details of the error | 0.6 |
| elaboration | String | Reserved field. The default value is null | 0.6 |
| opaque | LinkedHashMap | Reserved field. The default value is null | 0.6 |
| cause | ErrorCode | Root error that caused the current error. This field is null if there is no source error | 0.6 |
SDK Examples
CreateSessionForZCenterAccountAction action = new CreateSessionForZCenterAccountAction();
action.accountName = "test1";
action.source = "Local";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateSessionForZCenterAccountAction.Result res = action.call();
action = CreateSessionForZCenterAccountAction()
action.accountName = "test1"
action.source = "Local"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()
GetLoginCaptcha
API Request
GET zstack/v1/login/control/captchacurl -H "Content-Type: application/json;charset=UTF-8" -X GET http://localhost:8080/zstack/v1/login/control/captcha?resourceName=admin&loginType=Test| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| resourceName | String | query | Resource name | 2.6.0 | |
| loginType | String | query | Login type | 2.6.0 | |
| captchaUuid (optional) | String | query | Optional. The captcha UUID. | 0.6 | |
| systemTags (optional) | List | query | System tags | 2.6.0 | |
| userTags (optional) | List | query | User tags | 2.6.0 |
API Response
{
"captchaUuid": "ff0c9fd9ea99333aa9f47cf61b5f0900",
"captcha": "test"
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| captchaUuid | String | Unique identifier of the captcha | 2.6.0 |
| captcha | String | Base64-encoded captcha image | 2.6.0 |
| success | boolean | Whether the operation succeeded. | 2.6.0 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 2.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code number, a globally unique identifier for the error, e.g., SYS.1000, HOST.1001 | 2.6.0 |
| description | String | A brief description of the error | 2.6.0 |
| details | String | The detailed error information | 2.6.0 |
| elaboration | String | Reserved field. Defaults to null | 2.6.0 |
| opaque | LinkedHashMap | Reserved field. Defaults to null | 2.6.0 |
| cause | ErrorCode | The root error, the cause of the current error. This field is null if there is no root error | 2.6.0 |
SDK Examples
GetLoginCaptchaAction action = new GetLoginCaptchaAction();
action.resourceName = "admin";
action.loginType = "Test";
GetLoginCaptchaAction.Result res = action.call();action = GetLoginCaptchaAction()
action.resourceName = "admin"
action.loginType = "Test"
res = action.call()RefreshCaptcha
API Request
GET zstack/v1/captcha/refreshcurl -H "Content-Type: application/json;charset=UTF-8" -X GET http://localhost:8080/zstack/v1/captcha/refresh| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | query | The resource UUID, uniquely identifying this resource | 2.6.0 | |
| systemTags (optional) | List | query | Optional. The system tags. | 2.6.0 | |
| userTags (optional) | List | query | Optional. The user tags. | 2.6.0 |
API Response
On success, this API returns an empty JSON structure {}. On error, the returned JSON structure contains an error field, for example:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}
SDK Examples
RefreshCaptchaAction action = new RefreshCaptchaAction();
RefreshCaptchaAction.Result res = action.call();RefreshCaptchaAction action = RefreshCaptchaAction()
RefreshCaptchaAction.Result res = action.call()GetTwoFactorAuthenticationSecret
API Request
GET zstack/v1/twofactorauthentication/secretcurl -H "Content-Type: application/json;charset=UTF-8" \
-X GET http://localhost:8080/zstack/v1/twofactorauthentication/secret?name=user1&password=password&type=ldap| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| name | String | query | Resource name | 4.10.0 | |
| password | String | query | The password. | 4.10.0 | |
| captchaUuid (optional) | String | query | Optional. The captcha UUID. | 4.10.0 | |
| verifyCode (optional) | String | query | Optional. The verify code. | 4.10.0 | |
| systemTags (optional) | List | query | Optional. The system tags. | 4.10.0 | |
| userTags (optional) | List | query | Optional. The user tags. | 4.10.0 | |
| type | String | query | The resource type. |
|
5.0.0 |
API Response
{
"inventory": {
"uuid": "7870dee14bdb328c9eb6635f4f494fdd",
"secret": "ABCDEFGH12345678",
"status": "NewCreated",
"userType": "AccountVO"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 2.6.0 |
| inventory | TwoFactorAuthenticationSecretInventory | For details, see inventory | 2.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code number, a globally unique identifier for the error, e.g., SYS.1000, HOST.1001 | 2.6.0 |
| description | String | A brief description of the error | 2.6.0 |
| details | String | The detailed error information | 2.6.0 |
| elaboration | String | Reserved field. Defaults to null | 2.6.0 |
| opaque | LinkedHashMap | Reserved field. Defaults to null | 2.6.0 |
| cause | ErrorCode | The root error, the cause of the current error. This field is null if there is no root error | 2.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID, uniquely identifying this resource | 2.6.0 |
| secret | String | Two-factor authentication secret | 2.6.0 |
| createDate | Timestamp | Creation time | 3.4.0 |
| lastOpDate | Timestamp | Last modification time | 3.4.0 |
| userUuid | String | User UUID | 3.4.0 |
| userType | String | The user type. | 3.4.0 |
| status | TwoFactorAuthenticationSecretStatus | For details, see status | 3.4.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | Resource name | 3.4.0 |
| ordinal | int | The ordinal number. | 3.4.0 |
SDK Examples
GetTwoFactorAuthenticationSecretAction action = new GetTwoFactorAuthenticationSecretAction();
action.name = "user1";
action.password = "password";
action.type = "ldap";
GetTwoFactorAuthenticationSecretAction.Result res = action.call();action = GetTwoFactorAuthenticationSecretAction()
action.name = "user1"
action.password = "password"
action.type = "ldap"
res = action.call()QueryTwoFactorAuthentication
API Request
GET zstack/v1/twofactorauthentication/secretsGET zstack/v1/twofactorauthentication/secrets/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/twofactorauthentication/secrets?q=uuid=d65b4896eee23175b19e1267ee39ec60curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/twofactorauthentication/secrets/83358cec65073cbc876ddefe3d9b69feQueryable Fields
Run the CLI tool, enter and press the Tab key to view all queryable fields and cross-table queryable resource names.
API Response
{
"inventories": [
{
"uuid": "16620c01d20b390891ae1a1bc072ac0b",
"secret": "ABCDEFGH12345678",
"userUuid": "264d446f00e43793a2b0dcd21c367aaf",
"userType": "AccountVO",
"status": "NewCreated"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 3.4.0 |
| inventories | List | For details, see inventories | 3.4.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code number, a globally unique identifier for the error, e.g., SYS.1000, HOST.1001 | 3.4.0 |
| description | String | A brief description of the error | 3.4.0 |
| details | String | The detailed error information | 3.4.0 |
| elaboration | String | Reserved field. Defaults to null | 3.4.0 |
| opaque | LinkedHashMap | Reserved field. Defaults to null | 3.4.0 |
| cause | ErrorCode | The root error, the cause of the current error. This field is null if there is no root error | 3.4.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID, uniquely identifying this resource | 3.4.0 |
| secret | String | Two-factor authentication secret | 3.4.0 |
| userUuid | String | User UUID | 3.4.0 |
| userType | String | The user type. | 3.4.0 |
| createDate | Timestamp | Creation time | 3.4.0 |
| lastOpDate | Timestamp | Last modification time | 3.4.0 |
| status | TwoFactorAuthenticationSecretStatus | For details, see status | 3.4.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | Resource name | 3.4.0 |
| ordinal | int | The ordinal number. | 3.4.0 |
SDK Examples
QueryTwoFactorAuthenticationAction action = new QueryTwoFactorAuthenticationAction();
action.conditions = asList("uuid=4875201ba7443dddb51e336f9a23a20e");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryTwoFactorAuthenticationAction.Result res = action.call();QueryTwoFactorAuthenticationAction action = QueryTwoFactorAuthenticationAction()
action.conditions = ["uuid=ccf0f6cdf5a73bf7b961869f9bd8ca25"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryTwoFactorAuthenticationAction.Result res = action.call()GetTwoFactorAuthenticationState
API Request
GET zstack/v1/twofactorauthentication/statecurl -H "Content-Type: application/json;charset=UTF-8" -X GET http://localhost:8080/zstack/v1/twofactorauthentication/state| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| systemTags (Optional) | List | query | Optional. The system tags. | 2.6.0 | |
| userTags (Optional) | List | query | Optional. The user tags. | 2.6.0 |
API Response
{
"state": "Disable"
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| state | String | The resource state. | 2.6.0 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null on success. For details, see error | 2.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code number. A globally unique identifier for the error, e.g., SYS.1000, HOST.1001 | 2.6.0 |
| description | String | A brief description of the error | 2.6.0 |
| details | String | Detailed information about the error | 2.6.0 |
| elaboration | String | Reserved field. Default is null | 2.6.0 |
| opaque | LinkedHashMap | Reserved field. Default is null | 2.6.0 |
| cause | ErrorCode | The root error that caused the current error. This field is null if there is no root cause | 2.6.0 |
SDK Examples
GetTwoFactorAuthenticationStateAction action = new GetTwoFactorAuthenticationStateAction();
GetTwoFactorAuthenticationStateAction.Result res = action.call();GetTwoFactorAuthenticationStateAction action = GetTwoFactorAuthenticationStateAction()
GetTwoFactorAuthenticationStateAction.Result res = action.call()ResetTwoFactorAuthenticationSecret
API Request
PUT zstack/v1/twofactorauthentication/secretsAuthorization: OAuth the-session-uuid{
"resetTwoFactorAuthenticationSecret": {
"name": "user1",
"password": "password",
"type": "ldap"
},
"systemTags": [],
"userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"resetTwoFactorAuthenticationSecret":{"name":"user1","password":"password","type":"ldap"}}' \
http://localhost:8080/zstack/v1/twofactorauthentication/secrets| Name | Type | Location | Description | Valid Values | Since |
|---|---|---|---|---|---|
| name | String | body(contained in the resetTwoFactorAuthenticationSecret structure) |
Resource name | 4.10.0 | |
| password | String | body(contained in the resetTwoFactorAuthenticationSecret structure) |
4.10.0 | ||
| captchaUuid (optional) | String | body(contained in the resetTwoFactorAuthenticationSecret structure) |
4.10.0 | ||
| verifyCode (optional) | String | body(contained in the resetTwoFactorAuthenticationSecret structure) |
4.10.0 | ||
| system Tags (optional) | List | body | System tags | 4.10.0 | |
| userTags (optional) | List | body | User tags | 4.10.0 | |
| type | String | body(contained in the resetTwoFactorAuthenticationSecret structure) |
|
5.0.0 |
SDK Example
ResetTwoFactorAuthenticationSecretAction action = new ResetTwoFactorAuthenticationSecretAction();
action.name = "user1";
action.password = "password";
action.type = "ldap";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ResetTwoFactorAuthenticationSecretAction.Result res = action.call();action = ResetTwoFactorAuthenticationSecretAction()
action.name = "user1"
action.password = "password"
action.type = "ldap"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()QueryAccountResourceRef
API Request
GET zstack/v1/accounts/resources/refsAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/accounts/resources/refs?q=acountUuid=279c136f406e35a6a6874e39b231a2d3Queryable Fields
Run the CLI tool, type QueryAccountResourceRef, and press Tab to view all queryable fields and cross-table queryable resource names.
API Response
{
"inventories": [
{
"id": 1,
"accountUuid": "ef9a9b4c5bd338768f18148dbfe42f1c",
"resourceUuid": "6e06fe5d204f30ac80ffc4c2d6372e46",
"resourceType": "ImageVO",
"type": "Own"
}
]
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 0.6 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null on success. For details, see error | 0.6 |
| inventories | List | For details, see inventories | 0.6 |
| 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| accountUuid | String | Account UUID | 0.6 |
| resourceUuid | String | Resource UUID | 0.6 |
| resourceType | String | Resource type | 0.6 |
| createDate | Timestamp | Creation time | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.6 |
SDK Examples
QueryAccountResourceRefAction action = new QueryAccountResourceRefAction();
action.conditions = asList("acountUuid=dec9472c2f9b3f6abaa84ed78094171c");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAccountResourceRefAction.Result res = action.call();
QueryAccountResourceRefAction action = QueryAccountResourceRefAction()
action.conditions = ["acountUuid=05e51ebc332935769868ecde43b8f8e6"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAccountResourceRefAction.Result res = action.call()
CreateAccountGroup
API Request
POST zstack/v1/account-groupsAuthorization: OAuth the-session-uuid{
"params": {
"name": "my-group"
},
"systemTags": [],
"userTags": []
}
Note: 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 -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| 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
{
"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 |
| 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
CreateAccountGroupAction action = new CreateAccountGroupAction();
action.name = "my-group";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateAccountGroupAction.Result res = action.call();
CreateAccountGroupAction action = CreateAccountGroupAction()
action.name = "my-group"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateAccountGroupAction.Result res = action.call()
DeleteAccountGroup
API Request
DELETE zstack/v1/account-groups/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/account-groups/8dac6a80b68b3f7fbe44233dfe42a1d8| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | Account group UUID | 4.10.0 | |
| deleteMode (Optional) | String | body | Deletion mode (Permissive / Enforcing, default: Permissive) | 4.10.0 | |
| systemTags (Optional) | List | body | System tags | 4.10.0 | |
| userTags (Optional) | List | body | User tags | 4.10.0 |
API Response
{}. On failure, the returned JSON structure contains an error field, for example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Examples
DeleteAccountGroupAction action = new DeleteAccountGroupAction();
action.uuid = "8dac6a80b68b3f7fbe44233dfe42a1d8";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteAccountGroupAction.Result res = action.call();
DeleteAccountGroupAction action = DeleteAccountGroupAction()
action.uuid = "8dac6a80b68b3f7fbe44233dfe42a1d8"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteAccountGroupAction.Result res = action.call()
UpdateAccountGroup
API Request
PUT zstack/v1/account-groups/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"updateAccountGroup": {
"name": "my-group"
},
"systemTags": [],
"userTags": []
}
Note: 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 -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateAccountGroup":{"name":"my-group"}}' \
http://localhost:8080/zstack/v1/account-groups/0e830b9be4e33dd7b772eb9316ee6fb1/actions| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | Account group UUID | 4.10.0 | |
| name (Optional) | String | body (contained in the updateAccountGroup structure) |
Account group name | 4.10.0 | |
| description (Optional) | String | body (contained in the updateAccountGroup structure) |
Detailed description of the account group | 4.10.0 | |
| systemTags (Optional) | List | body | System tags | 4.10.0 | |
| userTags (Optional) | List | body | User tags | 4.10.0 |
API Response
{
"inventory": {
"uuid": "14295ba5c00d4fc596541e3fb5652924",
"name": "my-group",
"description": "my-group-description",
"rootGroupUuid": "14295ba5c00d4fc596541e3fb5652924",
"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 |
| 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
UpdateAccountGroupAction action = new UpdateAccountGroupAction();
action.uuid = "0e830b9be4e33dd7b772eb9316ee6fb1";
action.name = "my-group";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateAccountGroupAction.Result res = action.call();
UpdateAccountGroupAction action = UpdateAccountGroupAction()
action.uuid = "0e830b9be4e33dd7b772eb9316ee6fb1"
action.name = "my-group"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateAccountGroupAction.Result res = action.call()
MoveAccountGroup
API Request
PUT zstack/v1/account-groups/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"moveAccountGroup": {
"parentUuid": "996c8a1d6f273903b750254a69ec5a7b"
},
"systemTags": [],
"userTags": []
}
Note: 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 -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"moveAccountGroup":{"parentUuid":"996c8a1d6f273903b750254a69ec5a7b"}}' \
http://localhost:8080/zstack/v1/account-groups/efdbcd5b10ee3b9aa6b61f2ec4a0efcb/actions| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | Account group UUID | 4.10.0 | |
| parentUuid (Optional) | String | body (contained in the moveAccountGroup structure) |
Parent account group UUID | 4.10.0 | |
| systemTags (Optional) | List | body | System tags | 4.10.0 | |
| userTags (Optional) | List | body | User tags | 4.10.0 |
API Response
{
"inventory": {
"uuid": "c4f2348db99a4d64ac5319abecff4427",
"name": "my-group",
"description": "my-group-description",
"rootGroupUuid": "c4f2348db99a4d64ac5319abecff4427",
"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 |
| 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
MoveAccountGroupAction action = new MoveAccountGroupAction();
action.uuid = "efdbcd5b10ee3b9aa6b61f2ec4a0efcb";
action.parentUuid = "996c8a1d6f273903b750254a69ec5a7b";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
MoveAccountGroupAction.Result res = action.call();
MoveAccountGroupAction action = MoveAccountGroupAction()
action.uuid = "efdbcd5b10ee3b9aa6b61f2ec4a0efcb"
action.parentUuid = "996c8a1d6f273903b750254a69ec5a7b"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
MoveAccountGroupAction.Result res = action.call()
QueryAccountGroup
API Request
GET zstack/v1/account-groups
GET zstack/v1/account-groups/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/account-groups?q=name=my-groupcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/account-groups/64fb6148cb6438a088febdd75b819245Queryable Fields
Run the CLI tool, type QueryAccountGroup, and press Tab to view all queryable fields and cross-table queryable resource names.
API Response
{
"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"
}
]
}
| 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 |
| inventories | List | For details, see inventories | 4.10.0 |
| 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the account group, uniquely identifying this resource | 4.10.0 |
| name | String | Account group name | 4.10.0 |
| description | String | Detailed description of the account group | 4.10.0 |
| parentUuid | String | Parent account group UUID. null means no parent account group; it is the top-level group | 4.10.0 |
| rootGroupUuid | String | The UUID of the top-level account group. If this is the top-level group, rootGroupUuid points to itself | 4.10.0 |
| createDate | Timestamp | Creation time | 4.10.0 |
| lastOpDate | Timestamp | Last modification time | 4.10.0 |
SDK Examples
QueryAccountGroupAction action = new QueryAccountGroupAction();
action.conditions = asList("name=my-group");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAccountGroupAction.Result res = action.call();
QueryAccountGroupAction action = QueryAccountGroupAction()
action.conditions = ["name=my-group"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAccountGroupAction.Result res = action.call()
AddAccountToGroup
API Request
POST zstack/v1/account-groups/{groupUuid}/accountsAuthorization: OAuth the-session-uuid{
"params": {
"accountUuids": [
"ac243dc036043ad7a1ea649248e3e863"
]
},
"systemTags": [],
"userTags": []
}
Note: 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 -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"accountUuids":["ac243dc036043ad7a1ea649248e3e863"]}}'
http://localhost:8080/zstack/v1/account-groups/ab8c60e7c3bb3f05906adfc8f991c90b/accounts| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| groupUuid | String | url | Account group UUID | 4.10.0 | |
| accountUuids | List | body (contained in the params structure) | Account 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
{}. On failure, the returned JSON structure contains an error field, for example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Examples
AddAccountToGroupAction action = new AddAccountToGroupAction();
action.groupUuid = "ab8c60e7c3bb3f05906adfc8f991c90b";
action.accountUuids = asList("ac243dc036043ad7a1ea649248e3e863");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddAccountToGroupAction.Result res = action.call();AddAccountToGroupAction action = AddAccountToGroupAction()
action.groupUuid = "ab8c60e7c3bb3f05906adfc8f991c90b"
action.accountUuids = [ac243dc036043ad7a1ea649248e3e863]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddAccountToGroupAction.Result res = action.call()RemoveAccountFromGroup
API Request
DELETE zstack/v1/account-groups/{groupUuid}/accountsAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/account-groups/263094628051388c80bb011a63d070f1/accounts| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| groupUuid | String | url | Account group UUID | 4.10.0 | |
| accountUuids | List | body | Account 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
{}. On failure, the returned JSON structure contains an error field, for example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Examples
RemoveAccountFromGroupAction action = new RemoveAccountFromGroupAction();
action.groupUuid = "263094628051388c80bb011a63d070f1";
action.accountUuids = asList("0bc44812c44d314482e0fa4389271117");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveAccountFromGroupAction.Result res = action.call();
RemoveAccountFromGroupAction action = RemoveAccountFromGroupAction()
action.groupUuid = "263094628051388c80bb011a63d070f1"
action.accountUuids = [0bc44812c44d314482e0fa4389271117]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveAccountFromGroupAction.Result res = action.call()
AttachRoleToAccountGroup
API Request
POST zstack/v1/account-groups/{groupUuid}/rolesAuthorization: OAuth the-session-uuid{
"params": {
"roleUuids": [
"314c999460493f589963a021e0478054"
]
},
"systemTags": [],
"userTags": []
}
Note: 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 -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"roleUuids":["314c999460493f589963a021e0478054"]}}' \
http://localhost:8080/zstack/v1/account-groups/c271dab858c63bd288502e9ee4e0498d/roles| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| groupUuid | String | url | Account group UUID | 4.10.0 | |
| roleUuids | List | body (contained in the params structure) |
Role 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
{}. On failure, the returned JSON structure contains an error field, for example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Examples
AttachRoleToAccountGroupAction action = new AttachRoleToAccountGroupAction();
action.groupUuid = "c271dab858c63bd288502e9ee4e0498d";
action.roleUuids = asList("314c999460493f589963a021e0478054");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachRoleToAccountGroupAction.Result res = action.call();AttachRoleToAccountGroupAction action = AttachRoleToAccountGroupAction()
action.groupUuid = "c271dab858c63bd288502e9ee4e0498d"
action.roleUuids = [314c999460493f589963a021e0478054]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachRoleToAccountGroupAction.Result res = action.call()DetachRoleFromAccountGroup
API Request
DELETE zstack/v1/account-groups/{groupUuid}/rolesAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/account-groups/28c89d7eaf23373baad7e0f8889b2c3d/roles| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| groupUuid | String | url | Account group UUID | 4.10.0 | |
| roleUuids | List | body | Role 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
{}. On failure, the returned JSON structure contains an error field, for example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Examples
DetachRoleFromAccountGroupAction action = new DetachRoleFromAccountGroupAction();
action.groupUuid = "28c89d7eaf23373baad7e0f8889b2c3d";
action.roleUuids = asList("b63ab325307535a9b918d5b76b1246f5");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachRoleFromAccountGroupAction.Result res = action.call();
DetachRoleFromAccountGroupAction action = DetachRoleFromAccountGroupAction()
action.groupUuid = "28c89d7eaf23373baad7e0f8889b2c3d"
action.roleUuids = [b63ab325307535a9b918d5b76b1246f5]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachRoleFromAccountGroupAction.Result res = action.call()
GetAccountsInAccountGroup
Get Accounts in Account Group
API Request
GET zstack/v1/account-groups/tree
Authorization: OAuth the-session-uuid
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
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| groupUuid (Optional) | String | query | Account group UUID. A null value queries all top-level account groups | 4.10.0 | |
| level (Optional) | int | query | Depth for querying descendant subaccount groups. The default value is 0, which does not query accounts and groups under subaccounts. A value of 1 queries accounts and groups under subaccounts | 4.10.0 | |
| showGroup (Optional) | boolean | query | Whether the returned result contains account group information. The default value is true, which includes account group information in the returned result | 4.10.0 | |
| showAccount (Optional) | boolean | query | Whether the returned result contains account information. The default value is true, which includes account information in the returned result | 4.10.0 | |
| systemTags (Optional) | List | query | System tags | 4.10.0 | |
| userTags (Optional) | List | query | User tags | 4.10.0 |
API Response
{
"inventory": {
"groupUuid": "ff0b3ed5c5d7323b9150ffd45a820a00",
"groupName": "my-group",
"inventory": {
"uuid": "ff0b3ed5c5d7323b9150ffd45a820a00",
"name": "my-group",
"description": "my-group-description",
"rootGroupUuid": "ff0b3ed5c5d7323b9150ffd45a820a00",
"createDate": "Nov 14, 2017 2:20:57 PM",
"lastOpDate": "Nov 14, 2017 2:20:57 PM"
},
"accounts": [
{
"uuid": "ff0b33166633399aae77ea258d2f7900",
"name": "account1",
"description": "account1-description",
"type": "Normal",
"source": "Local",
"state": "Enabled",
"createDate": "Nov 14, 2017 2:20:57 PM",
"lastOpDate": "Nov 14, 2017 2:20:57 PM"
}
],
"groups": [
{
"groupUuid": "ff0b3ed5c5d7323b9150ffd45a820a00",
"groupName": "child-group",
"accounts": [],
"groups": []
}
]
}
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the request succeeded | 4.10.0 |
| inventories | List | For details, see inventories | 4.10.0 |
| error | ErrorCode | Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error | 4.10.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The account UUID, 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 |
| source | String | Account source, which is determined at creation and cannot be modified | 5.1.0 |
| state | String | Account state | 4.0.0 |
| createDate | Timestamp | Creation time | 4.0.0 |
| lastOpDate | Timestamp | Last modification time | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 | 0.6 |
| description | String | Summary description of the error | 0.6 |
| details | String | Details of the error | 0.6 |
| elaboration | String | Reserved field. The default value is null | 0.6 |
| opaque | LinkedHashMap | Reserved field. The default value is null | 0.6 |
| cause | ErrorCode | Root error that caused the current error. This field is null if there is no source error | 0.6 |
SDK Examples
GetAccountGroupTreeAction action = new GetAccountGroupTreeAction();
action.groupUuid = "470ce4d7a8dc32f597aa77675da3cd08";
action.level = 0;
action.showGroup = true;
action.showAccount = true;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetAccountGroupTreeAction.Result res = action.call();
action = GetAccountGroupTreeAction()
action.groupUuid = "470ce4d7a8dc32f597aa77675da3cd08"
action.level = 0
action.showGroup = true
action.showAccount = true
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()
GetResourceInAccountGroup
API Request
GET zstack/v1/account-groups/{groupUuid}/resourcesAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/account-groups/07954c2a73cf348383db3ccdecbb94fa/resources?includeInheritedResources=false| Name | Type | Location | Description | Optional Value | Since |
|---|---|---|---|---|---|
| groupUuid | String | url | Account group UUID | 4.10.0 | |
| includeInheritedResources (optional) | boolean | query | Whether to include resources inherited from the parent account group. If true, the result includes resources shared by the parent account group | 4.10.0 | |
| systemTags (optional) | List | query | System tags | 4.10.0 | |
| userTags (optional) | List | query | User tags | 4.10.0 |
API Response
{
"currentGroup": {
"groupUuid": "f34e8f7c5ae84dc2902c4c54a1eb957b",
"groupName": "my-group",
"resources": [
{
"uuid": "1783b75964da46bda91fe6ee371c8bd0",
"resourceName": "vm1",
"resourceType": "VmInstanceVO"
}
]
}
}| Name | Type | Description | Since |
|---|---|---|---|
| success | boolean | Whether the request succeeded | 4.10.0 |
| inventories | List | For details, see inventories | 4.10.0 |
| error | ErrorCode | Error code. A non-null value indicates that the operation failed; the field is null when the operation succeeds. For details, see error | 4.10.0 |
| Name | Type | Description | Since |
|---|---|---|---|
| uuid | String | Resource UUID, which uniquely identifies the resource | 4.0.0 |
| resourceName | String | Resource name | 4.0.0 |
| resourceType | String | Resource type | 4.0.0 |
| Name | Type | Description | Since |
|---|---|---|---|
| code | String | Error code, which globally and uniquely identifies an error, such as SYS.1000 or HOST.1001 | 0.6 |
| description | String | Summary of the error | 0.6 |
| details | String | Details of the error | 0.6 |
| elaboration | String | Reserved field. The default value is null | 0.6 |
| opaque | LinkedHashMap | Reserved field. The default value is null | 0.6 |
| cause | ErrorCode | Root error that caused the current error. The value is null if no root error exists | 0.6 |
SDK Example
GetResourceInAccountGroupAction action = new GetResourceInAccountGroupAction();
action.groupUuid = "ff0b3ed5c5d7323b9150ffd45a820a00";
action.includeInheritedResources = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetResourceInAccountGroupAction.Result res = action.call();action = GetResourceInAccountGroupAction()
action.groupUuid = "ff0b3ed5c5d7323b9150ffd45a820a00"
action.includeInheritedResources = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()QueryQuota
API Request
GET zstack/v1/accounts/quotasAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/accounts/quotas?q=name=testQueryable Fields
Run the CLI tool, type QueryQuota, and press Tab to view all queryable fields and cross-table queryable resource names.
API Response
{
"inventories": [
{
"name": "quota",
"identityUuid": "b30cc832a5493fe2a6184a78fc20c410",
"value": 20
}
]
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 0.6 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null on success. For details, see error | 0.6 |
| inventories | List | For details, see inventories | 0.6 |
| 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | Resource name | 0.6 |
| identityUuid | String | Identity UUID (account UUID or user UUID) | 0.6 |
| identityType | String | Identity type (account or user) | 0.6 |
| value | Long | Default quota value | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.6 |
| createDate | Timestamp | Creation time | 0.6 |
SDK Examples
QueryQuotaAction action = new QueryQuotaAction();
action.conditions = asList("name=test");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryQuotaAction.Result res = action.call();
QueryQuotaAction action = QueryQuotaAction()
action.conditions = ["name=test"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryQuotaAction.Result res = action.call()
UpdateQuota
API Request
PUT zstack/v1/accounts/quotas/actionsAuthorization: OAuth the-session-uuid{
"updateQuota": {
"identityUuid": "4d45e6c7787733979415760d2077fca0",
"name": "quotaname",
"value": 20
},
"systemTags": [],
"userTags": []
}
Note: 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 -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateQuota":{"identityUuid":"4d45e6c7787733979415760d2077fca0","name":"quotaname","value":20}}' \
http://localhost:8080/zstack/v1/accounts/quotas/actions| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| identityUuid | String | body (contained in the updateQuota structure) | The UUID of the identity entity (account) | 0.6 | |
| name | String | body (contained in the updateQuota structure) | Resource name | 0.6 | |
| value | long | body (contained in the updateQuota structure) | Quota value | 0.6 | |
| systemTags (Optional) | List | body | System tags | 0.6 | |
| userTags (Optional) | List | body | User tags | 0.6 |
API Response
{
"inventory": {
"name": "quota",
"identityUuid": "733689237dd9309f81e6a2f76b7c78b1",
"value": 20
}
}
| 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | Resource name | 0.6 |
| identityUuid | String | Identity UUID (account UUID or user UUID) | 0.6 |
| identityType | String | Identity type (account or user) | 0.6 |
| value | Long | Default quota value | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.6 |
| createDate | Timestamp | Creation time | 0.6 |
SDK Examples
UpdateQuotaAction action = new UpdateQuotaAction();
action.identityUuid = "4d45e6c7787733979415760d2077fca0";
action.name = "quotaname";
action.value = 20;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateQuotaAction.Result res = action.call();
UpdateQuotaAction action = UpdateQuotaAction()
action.identityUuid = "4d45e6c7787733979415760d2077fca0"
action.name = "quotaname"
action.value = 20
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateQuotaAction.Result res = action.call()
GetResourceNames
API Request
GET zstack/v1/resources/namesAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/resources/names?uuids=393ce06589043e33b397bc21043e8cd4&uuids=b62bdb31280a30a69c2f110bac8cb682| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuids | List | query | Resource UUID list | 0.6 | |
| systemTags (Optional) | List | query | Optional. The system tags. | 0.6 | |
| userTags (Optional) | List | query | Optional. The user tags. | 0.6 |
API Response
{
"inventories": [
{
"uuid": "9da599e443ec3d21bb4c766ad51784d3",
"resourceName": "zone",
"resourceType": "ZoneVO"
},
{
"uuid": "a6e1b35c657835c5972e94773e52949b",
"resourceName": "vm",
"resourceType": "VmInstanceVO"
}
]
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 0.6 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null on success. For details, see error | 2.0 |
| inventories | List | For details, see inventories | 2.0 |
| 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource, uniquely identifying this resource | 4.0.0 |
| resourceName | String | Resource name | 4.0.0 |
| resourceType | String | Resource type, e.g., VmInstanceVO for virtual machines | 4.0.0 |
SDK Examples
GetResourceNamesAction action = new GetResourceNamesAction();
action.uuids = asList("393ce06589043e33b397bc21043e8cd4","b62bdb31280a30a69c2f110bac8cb682");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetResourceNamesAction.Result res = action.call();
GetResourceNamesAction action = GetResourceNamesAction()
action.uuids = [393ce06589043e33b397bc21043e8cd4, b62bdb31280a30a69c2f110bac8cb682]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetResourceNamesAction.Result res = action.call()
GetResourceSharing
API Request
GET zstack/v1/iam1/resource-ensemble/view-sharingAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/iam1/resource-ensemble/view-sharing| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| resourceUuid | String | query | Resource UUID | 4.10.0 | |
| systemTags (Optional) | List | query | System tags | 4.10.0 | |
| userTags (Optional) | List | query | User tags | 4.10.0 |
API Response
{
"uuid": "a2a658dba2fa385382bc9f29a0788815",
"toPublic": false,
"accounts": [
{
"uuid": "7ded05202370411d85e6bf20168fa08f"
}
],
"accountGroups": [
{
"uuid": "2347044abdbb41d6b2bfb3cd196bfe79"
}
]
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| resourceUuid | String | Resource UUID | 4.10.0 |
| masterResourceUuid | String | If the resource belongs to a resource ensemble, this value is the UUID of the master resource in the ensemble. If not, this value is null | 4.10.0 |
| masterResourceType | String | If the resource belongs to a resource ensemble, this value is the type of the master resource in the ensemble. If not, this value is null | 4.10.0 |
| toPublic | boolean | Whether the resource is shared globally | 4.10.0 |
| success | boolean | Whether the request is successful | 4.10.0 |
| accounts | List | For details, see accounts | 4.10.0 |
| accountGroups | List | For details, see accountGroups | 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Account UUID | 4.10.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Account group UUID | 4.10.0 |
| 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
GetResourceSharingAction action = new GetResourceSharingAction();
action.uuid = "8fa73dc3301333e0aa39de406406831f";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetResourceSharingAction.Result res = action.call();
GetResourceSharingAction action = GetResourceSharingAction()
action.uuid = "8fa73dc3301333e0aa39de406406831f"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetResourceSharingAction.Result res = action.call()
ShareResourceToGroup
API Request
PUT zstack/v1/account-groups/resources/actionsAuthorization: OAuth the-session-uuid{
"shareResourceToGroup": {
"resourceUuids": [
"7f610aa37f17327d9b1dd74fc4ce871d"
],
"groupUuid": "2334f9ef50f03f2dba17abb79c6b5d53"
},
"systemTags": [],
"userTags": []
}
Note: 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 -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"shareResourceToGroup":{"resourceUuids":["7f610aa37f17327d9b1dd74fc4ce871d"],"groupUuid":"2334f9ef50f03f2dba17abb79c6b5d53"}}' \
http://localhost:8080/zstack/v1/account-groups/resources/actions| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| resourceUuids | List | body (contained in the shareResourceToGroup structure) |
Resource UUID list to share. Must be resources in a resource ensemble | 4.10.0 | |
| groupUuid | String | body (contained in the shareResourceToGroup structure) |
Account group UUID | 4.10.0 | |
| systemTags (Optional) | List | body | System tags | 4.10.0 | |
| userTags (Optional) | List | body | User tags | 4.10.0 |
API Response
{}. On failure, the returned JSON structure contains an error field, for example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}
SDK Examples
ShareResourceToGroupAction action = new ShareResourceToGroupAction();
action.resourceUuids = asList("7f610aa37f17327d9b1dd74fc4ce871d");
action.groupUuid = "2334f9ef50f03f2dba17abb79c6b5d53";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ShareResourceToGroupAction.Result res = action.call();
ShareResourceToGroupAction action = ShareResourceToGroupAction()
action.resourceUuids = [7f610aa37f17327d9b1dd74fc4ce871d]
action.groupUuid = "2334f9ef50f03f2dba17abb79c6b5d53"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ShareResourceToGroupAction.Result res = action.call()
RevokeResourceSharingToGroup
API Request
PUT zstack/v1/account-groups/resources/actionsAuthorization: OAuth the-session-uuid{
"revokeResourceSharingToGroup": {
"resourceUuids": [
"3d502ce7557c3aa29f40ab4cfde80bbd"
],
"groupUuid": "c84e3415faca3a94971b14ba5b4dceb2"
},
"systemTags": [],
"userTags": []
}
Note: 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 -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"revokeResourceSharingToGroup":{"resourceUuids":["3d502ce7557c3aa29f40ab4cfde80bbd"],"groupUuid":"c84e3415faca3a94971b14ba5b4dceb2"}}' \
http://localhost:8080/zstack/v1/account-groups/resources/actions| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| resourceUuids | List | body (contained in the revokeResourceSharingToGroup structure) |
Resource UUID list to revoke sharing. Must be resources in a resource ensemble | 4.10.0 | |
| groupUuid | String | body (contained in the revokeResourceSharingToGroup structure) |
Account group UUID | 4.10.0 | |
| systemTags (Optional) | List | body | System tags | 4.10.0 | |
| userTags (Optional) | List | body | User tags | 4.10.0 |
API Response
{}. On failure, the returned JSON structure contains an error field, for example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}
SDK Examples
RevokeResourceSharingToGroupAction action = new RevokeResourceSharingToGroupAction();
action.resourceUuids = asList("3d502ce7557c3aa29f40ab4cfde80bbd");
action.groupUuid = "c84e3415faca3a94971b14ba5b4dceb2";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RevokeResourceSharingToGroupAction.Result res = action.call();
RevokeResourceSharingToGroupAction action = RevokeResourceSharingToGroupAction()
action.resourceUuids = [3d502ce7557c3aa29f40ab4cfde80bbd]
action.groupUuid = "c84e3415faca3a94971b14ba5b4dceb2"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RevokeResourceSharingToGroupAction.Result res = action.call()
GetResourceEnsembleMembers
API Request
GET zstack/v1/iam1/resource-ensemble
GET zstack/v1/iam1/resource-ensemble/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/iam1/resource-ensemble?uuid=14c61568f49a45759c9a75c8fea4f854curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/iam1/resource-ensemble/14c61568f49a45759c9a75c8fea4f854?uuid=14c61568f49a45759c9a75c8fea4f854| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | query | The UUID of the resource. Any member in the resource ensemble is acceptable | 4.10.0 | |
| systemTags (Optional) | List | query | System tags | 4.10.0 | |
| userTags (Optional) | List | query | User tags | 4.10.0 |
API Response
{
"inventory": {
"masterUuid": "14c61568f49a45759c9a75c8fea4f854",
"masterResourceName": "VM1",
"masterResourceType": "VmInstanceVO",
"members": [
{
"uuid": "c1abb7bd0de8489bb183d829c3ccde0e",
"resourceName": "vmcdrom-VM1",
"resourceType": "VmCdRomVO"
},
{},
{}
]
}
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| masterUuid | String | The UUID of the master resource in the resource ensemble | 4.10.0 |
| masterResourceName | String | The name of the master resource in the resource ensemble | 4.10.0 |
| masterResourceType | String | The type of the master resource in the resource ensemble | 4.10.0 |
| members | List | For details, see members | 4.10.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource, uniquely identifying this resource | 4.0.0 |
| resourceName | String | Resource name | 4.0.0 |
| resourceType | String | Resource type | 4.0.0 |
| 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
GetResourceEnsembleMembersAction action = new GetResourceEnsembleMembersAction();
action.uuid = "14c61568f49a45759c9a75c8fea4f854";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetResourceEnsembleMembersAction.Result res = action.call();
GetResourceEnsembleMembersAction action = GetResourceEnsembleMembersAction()
action.uuid = "14c61568f49a45759c9a75c8fea4f854"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetResourceEnsembleMembersAction.Result res = action.call()
ShareResource
API Request
PUT zstack/v1/accounts/resources/actionsAuthorization: OAuth the-session-uuid{
"shareResource": {
"resourceUuids": [
"62113cf71892442daf57fe1a21606e7b",
"e8d14f0a61d7497c83cf9451bdd392a3"
],
"accountUuids": [
"17c6a138e5f04df4ad8938fa8bd06340",
"7063dc465e7c42739fdb5fd7d3e373f4"
],
"toPublic": false
},
"systemTags": [],
"userTags": []
}
Note: 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 -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"shareResource":{"resourceUuids":["05c5cdd1a5693e53ad3212a69b808883","49c6493b8eaf3765806aeb17071e779f"],"accountUuids":["62c084e3a2053b089b8b95fe452856e7","194f8c7d98963e628b9967b0df7eecae"],"toPublic":false}}' \
http://localhost:8080/zstack/v1/accounts/resources/actions| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| resourceUuids | List | body (contained in the shareResource structure) | Resource UUID list | 0.6 | |
| accountUuids (Optional) | List | body (contained in the shareResource structure) | Account UUID list | 0.6 | |
| toPublic (Optional) | boolean | body (contained in the shareResource structure) | Share globally Note: When the toPublic parameter is set to false, the account UUID list cannot be empty |
0.6 | |
| permission (Optional) | String | body (contained in the shareResource structure) | Sharing permission. WRITE indicates write permission; READ indicates read permission | 4.2.0 | |
| systemTags (Optional) | List | body | System tags | 0.6 | |
| userTags (Optional) | List | body | User tags | 0.6 |
API Response
{}. On failure, the returned JSON structure contains an error field, for example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Examples
ShareResourceAction action = new ShareResourceAction();
action.resourceUuids = asList("05c5cdd1a5693e53ad3212a69b808883","49c6493b8eaf3765806aeb17071e779f");
action.accountUuids = asList("62c084e3a2053b089b8b95fe452856e7","194f8c7d98963e628b9967b0df7eecae");
action.toPublic = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ShareResourceAction.Result res = action.call();
ShareResourceAction action = ShareResourceAction()
action.resourceUuids = [05c5cdd1a5693e53ad3212a69b808883, 49c6493b8eaf3765806aeb17071e779f]
action.accountUuids = [62c084e3a2053b089b8b95fe452856e7, 194f8c7d98963e628b9967b0df7eecae]
action.toPublic = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ShareResourceAction.Result res = action.call()
RevokeResourceSharing
API Request
PUT zstack/v1/accounts/resources/actionsAuthorization: OAuth the-session-uuid{
"revokeResourceSharing": {
"resourceUuids": [
"6551ce5374243f14875351219cdb69ba",
"18501632374c331692e10ab976f56e28"
],
"toPublic": false,
"accountUuids": [
"9a0c56a8bcbd31edbd384b28b8ffeffc",
"3627b63ad55939cf8df5fa4848abd6f2"
],
"all": false
},
"systemTags": [],
"userTags": []
}
Note: 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 -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"revokeResourceSharing":{"resourceUuids":["6551ce5374243f14875351219cdb69ba","18501632374c331692e10ab976f56e28"],"toPublic":false,"accountUuids":["9a0c56a8bcbd31edbd384b28b8ffeffc","3627b63ad55939cf8df5fa4848abd6f2"],"all":false}}' \
http://localhost:8080/zstack/v1/accounts/resources/actions| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| resourceUuids | List | body (contained in the revokeResourceSharing structure) | Resource UUID list | 0.6 | |
| toPublic (Optional) | boolean | body (contained in the structure) | Share globally | 0.6 | |
| accountUuids (Optional) | List | body (contained in the revokeResourceSharing structure) Note: When the all parameter is set to false, the account UUID list cannot be empty |
Account UUID list | 0.6 | |
| all (Optional) | boolean | body (contained in the revokeResourceSharing structure) | Optional. The all. | 0.6 | |
| systemTags (Optional) | List | body | System tags | 0.6 | |
| userTags (Optional) | List | body | User tags | 0.6 |
API Response
{}. On failure, the returned JSON structure contains an error field, for example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}
SDK Examples
RevokeResourceSharingAction action = new RevokeResourceSharingAction();
action.resourceUuids = asList("6551ce5374243f14875351219cdb69ba","18501632374c331692e10ab976f56e28");
action.toPublic = false;
action.accountUuids = asList("9a0c56a8bcbd31edbd384b28b8ffeffc","3627b63ad55939cf8df5fa4848abd6f2");
action.all = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RevokeResourceSharingAction.Result res = action.call();
RevokeResourceSharingAction action = RevokeResourceSharingAction()
action.resourceUuids = [6551ce5374243f14875351219cdb69ba, 18501632374c331692e10ab976f56e28]
action.toPublic = false
action.accountUuids = [9a0c56a8bcbd31edbd384b28b8ffeffc, 3627b63ad55939cf8df5fa4848abd6f2]
action.all = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RevokeResourceSharingAction.Result res = action.call()
ChangeResourceOwner
API Request
POST zstack/v1/account/{accountUuid}/resourcesAuthorization: OAuth the-session-uuid{
"params": {
"resourceUuid": "abfee8286ae43b19a02179cfe37b3294"
},
"systemTags": [],
"userTags": []
}
Note: 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 -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"resourceUuid":"abfee8286ae43b19a02179cfe37b3294"}}' \
http://localhost:8080/zstack/v1/account/e9da3eb01abc31c78ac24dec8c8c36b5/resources| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| accountUuid | String | url | Account UUID | 0.6 | |
| resourceUuid | String | body (contained in the params structure) |
Resource UUID | 0.6 | |
| systemTags (Optional) | List | body | System tags | 0.6 | |
| userTags (Optional) | List | body | User tags | 0.6 |
API Response
{
"inventory": {
"id": 1,
"accountUuid": "819950c427763deca51c94ad5e06da42",
"resourceUuid": "844a5dbbd2a632678b67a610e4d761b6",
"resourceType": "ImageVO",
"type": "Own"
}
}
| 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| accountUuid | String | Account UUID | 0.6 |
| resourceUuid | String | Resource UUID | 0.6 |
| resourceType | String | Resource type | 0.6 |
| createDate | Timestamp | Creation time | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.6 |
SDK Examples
ChangeResourceOwnerAction action = new ChangeResourceOwnerAction();
action.accountUuid = "e9da3eb01abc31c78ac24dec8c8c36b5";
action.resourceUuid = "abfee8286ae43b19a02179cfe37b3294";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeResourceOwnerAction.Result res = action.call();
ChangeResourceOwnerAction action = ChangeResourceOwnerAction()
action.accountUuid = "e9da3eb01abc31c78ac24dec8c8c36b5"
action.resourceUuid = "abfee8286ae43b19a02179cfe37b3294"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeResourceOwnerAction.Result res = action.call()
GetResourceAccount
Get Resource Account
API Request
GET zstack/v1/resources/accounts
Authorization: OAuth the-session-uuid
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X GET http://localhost:8080/zstack/v1/resources/accounts?resourceUuids=59fc59531b6639b3b0bd6263b021df4c&resourceUuids=77115316d36839e9b1a4f832f38de8ba
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| resourceUuids | List | query | The resource UUIDs. | 0.6 | |
| systemTags (Optional) | List | query | Optional. The system tags. | 0.6 | |
| userTags (Optional) | List | query | Optional. The user tags. | 0.6 |
API Response
{
"inventories": {
"db4e395223813bafa838ce4285a78757": {
"uuid": "ef68adaf368335ab8d15a4c2195749a7",
"name": "test",
"type": "Normal"
},
"736ee9f80a2230658e999c17e5be1835": {
"uuid": "ef68adaf368335ab8d15a4c2195749a7",
"name": "test",
"type": "Normal"
}
}
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 0.6 |
| error | ErrorCode | Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error | 0.6 |
| inventories | Map | For details, see inventories | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 | 0.6 |
| description | String | Summary description of the error | 0.6 |
| details | String | Details of the error | 0.6 |
| elaboration | String | Reserved field. The default value is null | 0.6 |
| opaque | LinkedHashMap | Reserved field. The default value is null | 0.6 |
| cause | ErrorCode | Root error that caused the current error. This field is null if there is no source error | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The account UUID, 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 |
| source | String | Account source, which is determined at creation and cannot be modified | 5.1.0 |
| state | String | Account state | 4.0.0 |
| createDate | Timestamp | Creation time | 4.0.0 |
| lastOpDate | Timestamp | Last modification time | 4.0.0 |
SDK Examples
GetResourceAccountAction action = new GetResourceAccountAction();
action.resourceUuids = asList("59fc59531b6639b3b0bd6263b021df4c","77115316d36839e9b1a4f832f38de8ba");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetResourceAccountAction.Result res = action.call();
action = GetResourceAccountAction()
action.resourceUuids = [59fc59531b6639b3b0bd6263b021df4c, 77115316d36839e9b1a4f832f38de8ba]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()
ValidateSession
API Request
GET zstack/v1/accounts/sessions/{sessionUuid}/validcurl -H "Content-Type: application/json;charset=UTF-8" \
-X GET http://localhost:8080/zstack/v1/accounts/sessions/525912127c633468b4fe142528ee3f3b/valid| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| sessionUuid | String | url | Session UUID | 0.6 | |
| systemTags (Optional) | List | query | System tags | 0.6 | |
| userTags (Optional) | List | query | User tags | 0.6 |
API Response
{
"validSession": true
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 0.6 |
| valid | boolean | Whether the session is valid | 0.6 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null on success. For details, see error | 0.6 |
| 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
ValidateSessionAction action = new ValidateSessionAction();
action.sessionUuid = "525912127c633468b4fe142528ee3f3b";
ValidateSessionAction.Result res = action.call();
ValidateSessionAction action = ValidateSessionAction()
action.sessionUuid = "525912127c633468b4fe142528ee3f3b"
ValidateSessionAction.Result res = action.call()
LogIn
API Request
PUT zstack/v1/loginAuthorization: OAuth the-session-uuid{
"logIn": {
"username": "admin",
"password": "password",
"loginType": "iam1"
},
"systemTags": [],
"userTags": []
}
Note: 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 -H "Content-Type: application/json;charset=UTF-8" \
-X PUT -d '{"logIn":{"username":"admin","password":"password","loginType":"iam1"}}' \
http://localhost:8080/zstack/v1/login| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| username | String | body (contained in the logIn structure) |
Username | 4.6.0 | |
| password | String | body (contained in the logIn structure) |
User password | 4.6.0 | |
| loginType | String | body (contained in the logIn structure) |
User type | 4.6.0 | |
| captchaUuid (Optional) | String | body (contained in the logIn structure) |
CAPTCHA UUID | 4.6.0 | |
| verifyCode (Optional) | String | body (contained in the logIn structure) |
Verification code | 4.6.0 | |
| clientInfo (Optional) | Map | body (contained in the logIn structure) |
Client information | 4.6.0 | |
| properties (Optional) | Map | body (contained in the logIn structure) |
Login properties | 4.6.0 | |
| systemTags (Optional) | List | body | System tags | 4.6.0 | |
| userTags (Optional) | List | body | User tags | 4.6.0 |
API Response
{
"inventory": {
"uuid": "5d77893e242d39ec8b9856a7b8762eab",
"accountUuid": "7ab57f322e4a396b8124ed4fda810966",
"expiredDate": "Nov 14, 2017 2:20:57 PM",
"noSessionEvaluation": false
}
}| 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource, uniquely identifying this resource | 0.6 |
| accountUuid | String | Account UUID | 0.6 |
| userUuid | String | User UUID | 0.6 |
| expiredDate | Timestamp | The expired date. | 0.6 |
| createDate | Timestamp | Creation time | 0.6 |
SDK Examples
LogInAction action = new LogInAction();
action.username = "admin";
action.password = "password";
action.loginType = "iam1";
LogInAction.Result res = action.call();LogInAction action = LogInAction()
action.username = "admin"
action.password = "password"
action.loginType = "iam1"
LogInAction.Result res = action.call()RenewSession
API Request
PUT zstack/v1/accounts/sessions/{sessionUuid}/renewAuthorization: OAuth the-session-uuid{
"renewSession": {
"duration": 100
},
"systemTags": [],
"userTags": []
}
Note: 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 -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"renewSession":{"duration":100}}' \
http://localhost:8080/zstack/v1/accounts/sessions/7b93b7648aea3c8d9109498a32288470/renew| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| sessionUuid | String | url | Session UUID | 2.3 | |
| duration (Optional) | Long | body (contained in the renewSession structure) | Optional. The duration. | 2.3 | |
| systemTags (Optional) | List | body | System tags | 2.3 | |
| userTags (Optional) | List | body | User tags | 2.3 |
API Response
{
"inventory": {
"uuid": "dce673d8c6d53988b188b4ac34e7304d",
"accountUuid": "fa58814a623d3778a8c91d11b74c6d38",
"expiredDate": "Nov 14, 2017 2:20:57 PM",
"noSessionEvaluation": false
}
}
| 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource, uniquely identifying this resource | 0.6 |
| accountUuid | String | Account UUID | 0.6 |
| userUuid | String | User UUID | 0.6 |
| expiredDate | Timestamp | Session expiration date | 0.6 |
| createDate | Timestamp | Creation time | 0.6 |
SDK Examples
RenewSessionAction action = new RenewSessionAction();
action.sessionUuid = "7b93b7648aea3c8d9109498a32288470";
action.duration = 100;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RenewSessionAction.Result res = action.call();
RenewSessionAction action = RenewSessionAction()
action.sessionUuid = "7b93b7648aea3c8d9109498a32288470"
action.duration = 100
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RenewSessionAction.Result res = action.call()
LogOut
API Request
URLs
DELETE zstack/v1/accounts/sessions/{sessionUuid}
curl -H "Content-Type: application/json;charset=UTF-8" \
-X DELETE http://localhost:8080/zstack/v1/accounts/sessions/77b3af8ddd67334ebdec0b2e32d1559b| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| sessionUuid (Optional) | String | url | Session UUID | 0.6 | |
| clientInfo (Optional) | Map | body (contained in the logInByAccount structure) | Client information | 3.5.0 | |
| systemTags (Optional) | List | body | System tags | 0.6 | |
| userTags (Optional) | List | body | User tags | 0.6 |
API Response
{}. On failure, the returned JSON structure contains an error field, for example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}
SDK Examples
LogOutAction action = new LogOutAction();
action.sessionId = "0c7e729fb59945938752cd4ec99c2a94";
LogOutAction.Result res = action.call();LogOutAction action = LogOutAction()
action.sessionId = "1cb84b3f5713432aaf42bc230c32aa20"
LogOutAction.Result res = action.call()DeleteRole
API Request
DELETE zstack/v1/identities/roles/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/identities/roles/6576d603b86634d68d49e9df50443e7f| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the role, uniquely identifying this resource | 4.10.0 | |
| deleteMode (Optional) | String | body | Delete mode. 'Permissive' is the pre-deletion check mode. If the role is still bound to accounts, the deletion fails. 'Enforcing' is the forced deletion mode. If the role is still bound to accounts, those accounts are automatically unbound from the role | 4.10.0 | |
| system Tags (Optional) | List | body | System tags | 4.10.0 | |
| userTags (Optional) | List | body | User tags | 4.10.0 |
API Response
{}. On failure, the returned JSON structure contains an error field, for example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}
SDK Examples
DeleteRoleAction action = new DeleteRoleAction();
action.uuid = "6576d603b86634d68d49e9df50443e7f";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteRoleAction.Result res = action.call();
DeleteRoleAction action = DeleteRoleAction()
action.uuid = "6576d603b86634d68d49e9df50443e7f"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteRoleAction.Result res = action.call()
QueryRole
API Request
GET zstack/v1/identities/roles
GET zstack/v1/identities/roles/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/identities/rolescurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/identities/roles/159398ac7d57325daeb62f4abbc5107bQueryable Fields
Run the CLI command-line tool, enter QueryRole and press Tab to view all queryable fields and the resource names available for cross-table queries.
API Response
{}. On failure, the returned JSON structure contains an error field, for example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}
SDK Examples
QueryRoleAction action = new QueryRoleAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryRoleAction.Result res = action.call();
QueryRoleAction action = QueryRoleAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryRoleAction.Result res = action.call()
GetRolePolicyActions
API Request
GET zstack/v1/identities/role/policy-actionsAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/identities/role/policy-actions?showAllPolicies=false| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| systemTags (Optional) | List | query | System tags | 4.10.0 | |
| userTags (Optional) | List | query | User tags | 4.10.0 | |
| showAllPolicies (Optional) | boolean | query | Whether to query all role policies in the system. If set to true, all role policies in the system are queried. If set to false, only the roles and policies owned by the current account are queried. | 4.10.0 |
API Response
{
"policies": [
".header.identity.APIChangeResourceOwnerMsg",
".header.identity.APICheckResourcePermissionMsg",
".header.identity.APICreateAccountMsg",
".header.identity.APIDeleteAccountMsg",
".header.identity.APIGetAccountQuotaUsageMsg",
".header.identity.APIGetResourceAccountMsg",
".header.identity.APILogInByAccountMsg",
".header.identity.APILogOutMsg",
".header.identity.APIQueryAccountMsg",
".header.identity.APIQueryAccountResourceRefMsg",
".header.identity.APIQueryQuotaMsg",
".header.identity.APIRenewSessionMsg",
".header.identity.APIRevokeResourceSharingMsg",
".header.identity.APIShareResourceMsg",
".header.identity.APIUpdateAccountMsg",
".header.identity.APIUpdateQuotaMsg",
".header.identity.APIValidateSessionMsg"
]
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| inventories | List | All matching actions | 4.10.0 |
| success | boolean | Whether the request is successful | 4.10.0 |
| error | ErrorCode | Error code. If not null, the operation has failed. This field is null when the operation succeeds. For details, see error | 4.10.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number. The globally unique identifier of the error, for example, SYS.1000 or HOST.1001. | 0.6 |
| description | String | 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 | Root error. The source error that caused the current error. This field is null if no root error exists. | 0.6 |
SDK Examples
GetRolePolicyActionsAction action = new GetRolePolicyActionsAction();
action.showAllPolicies = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetRolePolicyActionsAction.Result res = action.call();
GetRolePolicyActionsAction action = GetRolePolicyActionsAction()
action.showAllPolicies = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetRolePolicyActionsAction.Result res = action.call()
QueryRoleAccountRef
API Request
GET zstack/v1/identities/role-account-refsAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/identities/role-account-refs?q=roleUuid=686cb963323e491e955a0fd0b49dd743Queryable Fields
Run the CLI command line tool, enter QuerySharedResource and press the Tab key to view all queryable fields and cross-table queryable resource names.
API Response
{
"inventories": [
{
"roleUuid": "686cb963323e491e955a0fd0b49dd743",
"accountUuid": "5360250ef145409e862b4e99d2b2efc4",
"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 query is successful | 4.10.0 |
| inventories | List | For details, see inventories | 4.10.0 |
| error | ErrorCode | Error code. If not null, the operation has failed. This field is null when the operation succeeds. For details, see error | 4.10.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| roleUuid | String | Role UUID | 4.10.0 |
| accountUuid | String | Account UUID | 4.10.0 |
| accountPermissionFrom | String | Source of account permissions. If the account obtained the role by joining an account group, this value is the UUID of that account group. If the account is directly bound to the role, this value is null. | 4.10.0 |
| createDate | Timestamp | Creation time | 4.10.0 |
| lastOpDate | Timestamp | Last modification time | 4.10.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number. The globally unique identifier of the error, for example, SYS.1000 or HOST.1001. | 0.6 |
| description | String | 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 | Root error. The source error that caused the current error. This field is null if no root error exists. | 0.6 |
SDK Examples
QueryRoleAccountRefAction action = new QueryRoleAccountRefAction();
action.conditions = asList("roleUuid=686cb963323e491e955a0fd0b49dd743");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryRoleAccountRefAction.Result res = action.call();
QueryRoleAccountRefAction action = QueryRoleAccountRefAction()
action.conditions = ["roleUuid=686cb963323e491e955a0fd0b49dd743"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryRoleAccountRefAction.Result res = action.call()
AttachRoleToAccount
API Request
POST zstack/v1/identities/accounts/{accountUuid}/roles/{roleUuid}Authorization: OAuth the-session-uuid{
"params": {},
"systemTags": [],
"userTags": []
}
Note: In the preceding example, the systemTags and userTags fields are optional. They are listed to indicate that the body can contain these two fields.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' \
http://localhost:8080/zstack/v1/identities/accounts/053a25bbfe2c34a889d75601e64d4a51/roles/b7a901c45db33f12993c9c7aad874ff4| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| roleUuid | String | url | Role UUID | 4.10.0 | |
| accountUuid | String | url | Account UUID | 4.10.0 | |
| system Tags (Optional) | List | body | System tags | 4.10.0 | |
| userTags (Optional) | List | body | User tags | 4.10.0 |
API Response
{} on success. On failure, the returned JSON structure contains an error field, for example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}
SDK Examples
AttachRoleToAccountAction action = new AttachRoleToAccountAction();
action.roleUuid = "b7a901c45db33f12993c9c7aad874ff4";
action.accountUuid = "053a25bbfe2c34a889d75601e64d4a51";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachRoleToAccountAction.Result res = action.call();
AttachRoleToAccountAction action = AttachRoleToAccountAction()
action.roleUuid = "b7a901c45db33f12993c9c7aad874ff4"
action.accountUuid = "053a25bbfe2c34a889d75601e64d4a51"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachRoleToAccountAction.Result res = action.call()
DetachRoleFromAccount
API Request
DELETE zstack/v1/identities/accounts/{accountUuid}/roles/{roleUuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/identities/accounts/ac3ea9154a603cbcabbb1664dbcf66ef/roles/ca3f332b7ffd347fa30ba01be1176b96| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| roleUuid | String | url | Role UUID | 4.10.0 | |
| accountUuid | String | url | Account UUID | 4.10.0 | |
| deleteMode (Optional) | String | body | Deletion mode. This field is not effective for the current API. | 4.10.0 | |
| system Tags (Optional) | List | body | System tags | 4.10.0 | |
| userTags (Optional) | List | body | User tags | 4.10.0 |
API Response
{} on success. On failure, the returned JSON structure contains an error field, for example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}
SDK Examples
DetachRoleFromAccountAction action = new DetachRoleFromAccountAction();
action.roleUuid = "ca3f332b7ffd347fa30ba01be1176b96";
action.accountUuid = "ac3ea9154a603cbcabbb1664dbcf66ef";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachRoleFromAccountAction.Result res = action.call();
DetachRoleFromAccountAction action = DetachRoleFromAccountAction()
action.roleUuid = "ca3f332b7ffd347fa30ba01be1176b96"
action.accountUuid = "ac3ea9154a603cbcabbb1664dbcf66ef"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachRoleFromAccountAction.Result res = action.call()
AttachCCSCertificateToUser
API Request
POST zstack/v1/crypto/ccs-certificate/attach-account/{accountUuid}Authorization: OAuth the-session-uuid{
"params": {
"certificateUuid": "37efdf76b03a3028926549ea5f1253f3",
"state": "enable"
},
"systemTags": [],
"userTags": []
}
Note: In the preceding example, the systemTags and userTags fields are optional. They are listed to indicate that the body can contain these two fields.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"certificateUuid":"37efdf76b03a3028926549ea5f1253f3","state":"enable"}}' \
http://localhost:8080/zstack/v1/crypto/ccs-certificate/attach-account/e0deabb1107f32e7b715d6b5e7f39334| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| certificateUuid (Optional) | String | body (enclosed in the params structure) |
UUID of the CCS certificate | 4.10.0 | |
| accountUuid | String | url | Account UUID | 4.10.0 | |
| state (Optional) | String | body (enclosed in the params structure)vv |
Enable or disable. Specifies whether to enable UKey authentication for login when attaching the CCS certificate to the user. If set to enable, the user must pass UKey authentication for subsequent logins. If set to disable, UKey authentication is not enabled temporarily, but can be enabled later through UpdateCCSCertificateUserState. |
|
4.10.0 |
| system Tags (Optional) | List | body | System tags | 4.10.0 | |
| userTags (Optional) | List | body | User tags | 4.10.0 |
API Response
{
"inventory": {
"uuid": "271c21f7ef8c4385b09846341cc9deac",
"algorithm": "SM2",
"format": "CER",
"issuerDN": "C\u003dcn,O\u003dinfosec,OU\u003dsystem,CN\u003dca62_sm2",
"subjectDN": "C\u003dCN,O\u003dZStack,OU\u003dZStack,CN\u003dZStackTest2",
"serNumber": "13055887750776402041",
"effectiveTime": "Oct 15, 2021 10:50:09 AM",
"expirationTime": "Oct 15, 2024 10:50:09 AM"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the attach operation is successful | 4.10.0 |
| inventory | CCSCertificateInventory | For details, see inventory | 4.10.0 |
| error | ErrorCode | Error code. If not null, the operation has failed. This field is null when the operation succeeds. For details, see error | 4.10.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID. Uniquely identifies the resource. | 4.3.12 |
| algorithm | String | Certificate type | 4.3.12 |
| format | String | Certificate format. CER for Chinese national cryptographic standards. Other formats include CRT, DER, JKS, etc. | 4.3.12 |
| issuerDN | String | Issuer DN (issuer-DN-distinguished name), for example, CN=sm2,O=test,C=cn | 4.3.12 |
| subjectDN | String | Subject DN | 4.3.12 |
| serNumber | Long | Certificate serial number. Combined with subjectDN as a composite key, it is globally unique. | 4.3.12 |
| effectiveTime | Timestamp | Effective date | 4.3.12 |
| expirationTime | Timestamp | Expiration date | 4.3.12 |
| createDate | Timestamp | Creation time | 4.3.12 |
| lastOpDate | Timestamp | Last modification time | 4.3.12 |
| userCertificateRefs | List | For details, see userCertificateRefs | 4.3.12 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| userUuid | String | User UUID | 4.3.12 |
| certificateUuid | String | CCS certificate UUID | 4.3.12 |
| createDate | Timestamp | Creation time | 4.3.12 |
| lastOpDate | Timestamp | Last modification time | 4.3.12 |
| state | CCSCertificateUserState | For details, see state | 4.3.12 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| Enabled | CCSCertificateUserState | Verification required | 4.3.12 |
| Disabled | CCSCertificateUserState | Verification not required | 4.3.12 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number. The globally unique identifier of the error, for example, SYS.1000 or HOST.1001. | 0.6 |
| description | String | 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 | Root error. The source error that caused the current error. This field is null if no root error exists. | 0.6 |
SDK Examples
AttachCCSCertificateToAccountAction action = new AttachCCSCertificateToAccountAction();
action.certificateUuid = "37efdf76b03a3028926549ea5f1253f3";
action.accountUuid = "e0deabb1107f32e7b715d6b5e7f39334";
action.state = "enable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachCCSCertificateToAccountAction.Result res = action.call();AttachCCSCertificateToAccountAction action = AttachCCSCertificateToAccountAction()
action.certificateUuid = "37efdf76b03a3028926549ea5f1253f3"
action.accountUuid = "e0deabb1107f32e7b715d6b5e7f39334"
action.state = "enable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachCCSCertificateToAccountAction.Result res = action.call()DetachCCSCertificateFromUser
API Request
POST zstack/v1/crypto/ccs-certificate/detach-account/{accountUuid}Authorization: OAuth the-session-uuid{
"params": {},
"systemTags": [],
"userTags": []
}
Note: In the preceding example, the systemTags and userTags fields are optional. They are listed to indicate that the body can contain these two fields.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' \
http://localhost:8080/zstack/v1/crypto/ccs-certificate/detach-account/0f708fb369393654acdf1f145a2408c2| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| accountUuid | String | url | UUID of the user to detach | 4.10.0 | |
| system Tags (Optional) | List | body | System tags | 4.10.0 | |
| userTags (Optional) | List | body | User tags | 4.10.0 |
API Response
{} on success. On failure, the returned JSON structure contains an error field, for example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Examples
DetachCCSCertificateFromAccountAction action = new DetachCCSCertificateFromAccountAction();
action.accountUuid = "0f708fb369393654acdf1f145a2408c2";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachCCSCertificateFromAccountAction.Result res = action.call();DetachCCSCertificateFromAccountAction action = DetachCCSCertificateFromAccountAction()
action.accountUuid = "0f708fb369393654acdf1f145a2408c2"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachCCSCertificateFromAccountAction.Result res = action.call()UpdateCCSCertificateUserState
API Request
POST zstack/v1/crypto/ccs-certificate/update-state/{accountUuid}Authorization: OAuth the-session-uuid{
"params": {
"state": "enable"
},
"systemTags": [],
"userTags": []
}
Note: In the preceding example, the systemTags and userTags fields are optional. They are listed to indicate that the body can contain these two fields.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"state":"enable"}}' \
http://localhost:8080/zstack/v1/crypto/ccs-certificate/update-state/c418d26244b43e31bfe400652695f62a| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| accountUuid | String | url | Account UUID | 4.10.0 | |
| state | String | body (enclosed in the params structure) |
State. Specifies whether to enable certificate verification on the next login. |
|
4.10.0 |
| system Tags (Optional) | List | body | System tags | 4.10.0 | |
| userTags (Optional) | List | body | User tags | 4.10.0 |
API Response
{
"inventory": {
"uuid": "4e1cab9a3a0f4a1eb6a919510814d8f8",
"algorithm": "SM2",
"format": "CER",
"issuerDN": "C\u003dcn,O\u003dinfosec,OU\u003dsystem,CN\u003dca62_sm2",
"subjectDN": "C\u003dCN,O\u003dZStack,OU\u003dZStack,CN\u003dZStackTest2",
"serNumber": "13055887750776402041",
"effectiveTime": "Oct 15, 2021 10:50:09 AM",
"expirationTime": "Oct 15, 2024 10:50:09 AM"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.10.0 |
| inventory | CCSCertificateInventory | For details, see inventory | 4.10.0 |
| error | ErrorCode | Error code. If not null, the operation has failed. This field is null when the operation succeeds. For details, see error | 4.10.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID. Uniquely identifies the resource. | 4.3.12 |
| algorithm | String | Certificate type | 4.3.12 |
| format | String | Certificate format. CER for Chinese national cryptographic standards. Other formats include CRT, DER, JKS, etc. | 4.3.12 |
| issuerDN | String | Issuer DN (issuer-DN-distinguished name), for example, CN=sm2,O=test,C=cn | 4.3.12 |
| subjectDN | String | Subject DN | 4.3.12 |
| serNumber | Long | Certificate serial number. Combined with subjectDN as a composite key, it is globally unique. | 4.3.12 |
| effectiveTime | Timestamp | Effective date | 4.3.12 |
| expirationTime | Timestamp | Expiration date | 4.3.12 |
| createDate | Timestamp | Creation time | 4.3.12 |
| lastOpDate | Timestamp | Last modification time | 4.3.12 |
| userCertificateRefs | List | For details, see userCertificateRefs | 4.3.12 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| userUuid | String | User UUID | 4.3.12 |
| certificateUuid | String | CCS certificate UUID | 4.3.12 |
| createDate | Timestamp | Creation time | 4.3.12 |
| lastOpDate | Timestamp | Last modification time | 4.3.12 |
| state | CCSCertificateUserState | For details, see state | 4.3.12 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| Enabled | CCSCertificateUserState | Verification required | 4.3.12 |
| Disabled | CCSCertificateUserState | Verification not required | 4.3.12 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number. The globally unique identifier of the error, for example, SYS.1000 or HOST.1001. | 0.6 |
| description | String | 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 | Root error. The source error that caused the current error. This field is null if no root error exists. | 0.6 |
SDK Examples
UpdateCCSCertificateAccountStateAction action = new UpdateCCSCertificateAccountStateAction();
action.accountUuid = "c418d26244b43e31bfe400652695f62a";
action.state = "enable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateCCSCertificateAccountStateAction.Result res = action.call();UpdateCCSCertificateAccountStateAction action = UpdateCCSCertificateAccountStateAction()
action.accountUuid = "c418d26244b43e31bfe400652695f62a"
action.state = "enable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateCCSCertificateAccountStateAction.Result res = action.call()ChangeAccountType
API Request
PUT zstack/v1/accounts/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"changeAccountType": {
"type": "SystemAdmin"
},
"systemTags": [],
"userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeAccountType":{"type":"SystemAdmin"}}' \
http://localhost:8080/zstack/v1/accounts/f0c72e5b9d723dbaa716d2f0fad341d9/actions| Name | Type | Location | Description | Valid Values | Since |
|---|---|---|---|---|---|
| uuid | String | url | Resource UUID, which uniquely identifies the resource | 5.0.0 | |
| type | String | body(contained in the changeAccountType structure) |
Account type. SystemAdmin indicates an administrator, and Normal indicates a regular user. Normal is not supported currently, which means privilege downgrade is not supported currently. | 5.0.0 | |
| system Tags (optional) | List | body | System tags | 5.0.0 | |
| userTags (optional) | List | body | User tags | 5.0.0 |
SDK Example
ChangeAccountTypeAction action = new ChangeAccountTypeAction();
action.uuid = "f0c72e5b9d723dbaa716d2f0fad341d9";
action.type = "SystemAdmin";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeAccountTypeAction.Result res = action.call();action = ChangeAccountTypeAction()
action.uuid = "f0c72e5b9d723dbaa716d2f0fad341d9"
action.type = "SystemAdmin"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()