ZStack Cloud Platform
Single Server, Free Trial for One Year
POST zstack/v1/zonesAuthorization: OAuth the-session-uuid{ "params": { "name": "TestZone", "description": "test zone" }, "systemTags": [], "userTags": [] }
Note: 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 -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| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in params structure) | Resource name | 0.6 | |
| description (optional) | String | body (contained in params structure) | Resource description | 0.6 | |
| resourceUuid (optional) | String | body (contained in params structure) | User specified resource uuid | 0.6 | |
| systemTags (optional) | List | body | System tag | 0.6 | |
| userTags (optional) | List | body | User tag | 0.6 |
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" } } | Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | Error code. If not null, the operation failed. If null, the operation succeeded. See details error | 0.6 |
| inventory | ZoneInventory | See details inventory | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number, globally unique identifier of the error, e.g. SYS.1000, HOST.1001 | 0.6 |
| description | String | Brief description of the error | 0.6 |
| details | String | Detailed error information | 0.6 |
| elaboration | String | Reserved field, default is null | 0.6 |
| opaque | LinkedHashMap | Reserved field, default is null | 0.6 |
| cause | ErrorCode | Root cause, the error that caused the current error. If there is no original error, this field is null | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID, uniquely identifies the resource | 0.6 |
| name | String | Resource name | 0.6 |
| description | String | Resource description | 0.6 |
| state | String | 0.6 | |
| type | String | 0.6 | |
| createDate | Timestamp | Creation time | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.6 |
CreateZoneAction action = new CreateZoneAction(); action.name = "TestZone"; action.description = "test zone"; action.sessionId = "982a09118de64ef7a9051fde346270c5"; CreateZoneAction.Result res = action.call();CreateZoneAction action = CreateZoneAction() action.name = "TestZone" action.description = "test zone" action.sessionId = "79e260dca17b4bdf9b7d7b4e150883df" CreateZoneAction.Result res = action.call()DELETE zstack/v1/zones/{uuid}?deleteMode={deleteMode}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth 05fc0a34be264877a9dc8dfb5f90d619" \ -X DELETE http://localhost:8080/zstack/v1/zones/d3483ca440334af3acc09d8631e814c6?deleteMode=Permissive| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | Resource UUID, uniquely identifies the resource | 0.6 | |
| deleteMode (optional) | String | body |
| 0.6 | |
| systemTags (optional) | List | body | System tag | 0.6 | |
| userTags (optional) | List | body | User tag | 0.6 |
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" } } DeleteZoneAction action = new DeleteZoneAction(); action.uuid = "8987020fccd14191a5a89dda6f3db81e"; action.deleteMode = "Permissive"; action.sessionId = "835b1b72c4554a7e92c425ad9eaebc6d"; DeleteZoneAction.Result res = action.call();DeleteZoneAction action = DeleteZoneAction() action.uuid = "a4bcb439c99a42e197cac90be83e706e" action.deleteMode = "Permissive" action.sessionId = "6eaf02e52c884e378a3730ce4267d83a" DeleteZoneAction.Result res = action.call()GET zstack/v1/zones GET zstack/v1/zones/{uuid}Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth e556a104ae874303897ac67d83564086" \ -X GET http://localhost:8080/zstack/v1/zones?q=name=TestZone&q=state=Enabled curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth 7e9fd15bba0d43a2b1a7212c85fb8787" \ -X GET http://localhost:8080/zstack/v1/zones/9276d05c7d7545d6b61bfc50f017b86c Queryable Fields
Run the CLI command tool, enter QueryZone and press Tab to view all queryable fields and resource names that can be queried across tables.
{ "inventories": [ { "uuid": "a58fb4240ed04129a0896b565f24a9df", "name": "TestZone", "description": "Test", "state": "Enabled", "type": "zstack", "createDate": "Jun 7, 2017 9:20:29 PM", "lastOpDate": "Jun 7, 2017 9:20:29 PM" } ] }| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | Error code. If not null, the operation failed. If null, the operation succeeded. See details error | 0.6 |
| inventories | List | See details inventories | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number, globally unique identifier of the error, e.g. SYS.1000, HOST.1001 | 0.6 |
| description | String | Brief description of the error | 0.6 |
| details | String | Detailed error information | 0.6 |
| elaboration | String | Reserved field, default is null | 0.6 |
| opaque | LinkedHashMap | Reserved field, default is null | 0.6 |
| cause | ErrorCode | Root cause, the error that caused the current error. If there is no original error, this field is null | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID, uniquely identifies the resource | 0.6 |
| name | String | Resource name | 0.6 |
| description | String | Resource description | 0.6 |
| state | String | 0.6 | |
| type | String | 0.6 | |
| createDate | Timestamp | Creation time | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.6 |
QueryZoneAction action = new QueryZoneAction(); action.conditions = asList("name=TestZone","state=Enabled"); action.sessionId = "608079b963b54e8a9aa3a2291adae89f"; QueryZoneAction.Result res = action.call();QueryZoneAction action = QueryZoneAction() action.conditions = ["name=TestZone","state=Enabled"] action.sessionId = "be89929b7fd34d25a5c1a7f47f4490cd" QueryZoneAction.Result res = action.call()