Create Data Center

POST/zstack/v1/zones

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "name": "TestZone",
    "description": "test zone"
  },
  "systemTags": [],
  "userTags": []
}

In the above example, systemTags and userTags fields can be omitted. They are listed to indicate that these two fields can be included in the body.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"TestZone","description":"test zone"}}' \
http://localhost:8080/zstack/v1/zones

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
nameStringbody (contained in params structure)Resource name 0.6
description (optional)Stringbody (contained in params structure)Resource description 0.6
resourceUuid (optional)Stringbody (contained in params structure)User specified resource uuid 0.6
systemTags (optional)ListbodySystem tag 0.6
userTags (optional)ListbodyUser tag 0.6

API Response

Response Example

{
  "inventory": {
    "uuid": "0d26522305c34d07b5661ccda62053c0",
    "name": "TestZone",
    "description": "Test",
    "state": "Enabled",
    "type": "zstack",
    "createDate": "Jun 7, 2017 9:20:28 PM",
    "lastOpDate": "Jun 7, 2017 9:20:28 PM"
  }
}
NameTypeDescriptionStarting Version
errorErrorCodeError code. If not null, the operation failed. If null, the operation succeeded. See details error0.6
inventoryZoneInventorySee details inventory0.6

error

NameTypeDescriptionStarting Version
codeStringError code number, globally unique identifier of the error, e.g. SYS.1000, HOST.10010.6
descriptionStringBrief description of the error0.6
detailsStringDetailed error information0.6
elaborationStringReserved field, default is null0.6
opaqueLinkedHashMapReserved field, default is null0.6
causeErrorCodeRoot cause, the error that caused the current error. If there is no original error, this field is null0.6

inventory

NameTypeDescriptionStarting Version
uuidStringResource UUID, uniquely identifies the resource0.6
nameStringResource name0.6
descriptionStringResource description0.6
stateString 0.6
typeString 0.6
createDateTimestampCreation time0.6
lastOpDateTimestampLast modification time0.6

SDK Examples

Java SDK

CreateZoneAction action = new CreateZoneAction();
action.name = "TestZone";
action.description = "test zone";
action.sessionId = "982a09118de64ef7a9051fde346270c5";
CreateZoneAction.Result res = action.call();

Python SDK

CreateZoneAction action = CreateZoneAction()
action.name = "TestZone"
action.description = "test zone"
action.sessionId = "79e260dca17b4bdf9b7d7b4e150883df"
CreateZoneAction.Result res = action.call()