Create AccessKey

POST/zstack/v1/accesskeys

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "accountUuid": "db517023502d34ef9309e49674af88d0"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding example, the systemTags and userTags fields are optional. They are listed here to show that the body can contain these two fields.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"accountUuid":"db517023502d34ef9309e49674af88d0"}}' \
http://localhost:8080/zstack/v1/accesskeys

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
accountUuidStringbody (enclosed in the params structure)Account UUID 4.0.0
userUuidStringbody (enclosed in the params structure)This value is deprecated 4.0.0
description (Optional)Stringbody (enclosed in the params structure)Detailed description of the resource 4.0.0
AccessKeyID (Optional)Stringbody (enclosed in the params structure)Generated AccessKeyID 4.0.0
AccessKeySecret (Optional)Stringbody (enclosed in the params structure)Generated AccessKeySecret 4.0.0
resourceUuid (Optional)Stringbody (enclosed in the params structure)  4.0.0
systemTags (Optional)Listbody  4.0.0
userTags (Optional)Listbody  4.0.0

API Response

Response Example

{
  "inventory": {
    "uuid": "01f82a92a3f83136b3a5fa13b0f1dde6",
    "accountUuid": "bc81e5aad7363ebaa904ee81edbfdd1f",
    "userUuid": "bc81e5aad7363ebaa904ee81edbfdd1f",
    "AccessKeyID": "1234567890abcdedfhij",
    "AccessKeySecret": "1234567890abcdedfhij1234567890abcdedfhij",
    "state": "Enabled"
  }
}
NameTypeDescriptionStarting Version
successboolean 4.0.0
errorErrorCodeError code. If not null, the operation has failed. This field is null when the operation succeeds. For details, see error4.0.0
inventoryAccessKeyInventoryFor details, see inventory4.0.0

error

NameTypeDescriptionStarting Version
codeStringError code number. The globally unique identifier of the error, for example, SYS.1000 or HOST.1001.0.6
descriptionStringBrief description of the error0.6
detailsStringDetailed information about the error0.6
elaborationStringReserved field. Default is null.0.6
opaqueLinkedHashMapReserved field. Default is null.0.6
causeErrorCodeRoot error. The source error that caused the current error. This field is null if no root error exists.0.6

inventory

NameTypeDescriptionStarting Version
uuidStringResource UUID. Uniquely identifies the resource.4.0.0
descriptionStringDetailed description of the resource4.0.0
accountUuidStringAccount UUID4.0.0
userUuidStringThis value is deprecated4.0.0
AccessKeyIDString 4.0.0
AccessKeySecretString 4.0.0
createDateTimestampCreation time4.0.0
lastOpDateTimestampLast modification time4.0.0
stateAccessKeyStateFor details, see state4.0.0

state

NameTypeDescriptionStarting Version
nameStringResource name4.0.0
ordinalint 4.0.0

SDK Examples

Java SDK

CreateAccessKeyAction action = new CreateAccessKeyAction();
action.accountUuid = "db517023502d34ef9309e49674af88d0";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateAccessKeyAction.Result res = action.call();

Python SDK

CreateAccessKeyAction action = CreateAccessKeyAction()
action.accountUuid = "db517023502d34ef9309e49674af88d0"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateAccessKeyAction.Result res = action.call()