License Operations
GetLicenseInfo
API Request
URLs
GET zstack/v1/licenses
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-X GET http://localhost:8080/zstack/v1/licenses?
Request Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| additionSession | String | query | Optional. The additional information. The value is a JSON-formatted string. | 4.1.0 | |
| systemTags | List | query | Optional. The system tags. | 0.6 | |
| userTags | List | query | Optional. The user tags. | 0.6 |
ZStack Cloud allows you to obtain the ID of the Cloud by adding the platformId option to SystemTags.
- Format of the platformId option:
platformId::{%s}。{%s}represents the first 10 digits of the md5 value calculated using the request key of the Cloud. - Example:
platformId::a95d3ee34r
- Format of the platformId option:
API Response
Sample Response
{
"inventory": {
"licenseType": "Free",
"licenseRequest": "example request",
"issuedDate": "2017-01-19 14:31:06",
"user": "example",
"hostNum": 10.0,
"expired": true,
"managementNodeUuid": "00898b3538e53e70bb7521e54ff80276"
},
"additions": []
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 0.6 |
| inventory | LicenseInventory | See inventory. | 0.6 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| licenseType | String | The license type. | 0.6 |
| licenseRequest | String | The license request. | 0.6 |
| expiredDate | String | The expired date. | 0.6 |
| issuedDate | String | The issued date. | 0.6 |
| user | String | The user. | 0.6 |
| prodInfo | String | The license product name. | 4.1.0 |
| hostNum | Integer | The number of host. | 0.6 |
| cpuNum | Integer | The number of CPUs. | 0.6 |
| availableHostNum | Integer | The number of available host. | 0.6 |
| availableCpuNum | Integer | The number of available CPU. | 0.6 |
| expired | boolean | The expired. | 0.6 |
SDK Sample
Java SDK
GetLicenseInfoAction action = new GetLicenseInfoAction();
GetLicenseInfoAction.Result res = action.call();
Python SDK
action = GetLicenseInfoAction()
res = action.call()
GetLicenseRecords
API Request
URLs
GET zstack/v1/licenses/records
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-X GET http://localhost:8080/zstack/v1/licenses/records?limit=20.0&start=0.0&replyWithCount=true&count=false&sortBy=uploadDate&sortDirection=desc
Request Parameters
| Name | Type | Location | Description | Valid Value | Starting Version |
|---|---|---|---|---|---|
| limit | Integer | query | Optional. The maximum number of records that cab be retrieved. Default: 20. This parameter is similar to the limit parameter in MySQL. | 4.1.0 | |
| start | Integer | query | Optional. The position to start a query. You need to set this parameter if you specify thelimit parameter. This parameter is similar to the offset parameter in MySQL. |
4.1.0 | |
| replyWithCount | boolean | query | Optional. Specifies whether to return the number of records. If you set the value to true, the number of records are returned. | 4.1.0 | |
| count | boolean | query | Optional. Specifies whether to count the number of records that meet the specified conditions. This parameter is similar to the count() function. If you set the value to true, the number of records that meet the specified conditions is calculated and returned. |
4.1.0 | |
| sortBy | String | query | Optional. Specifies to start records by a key, for example sortBy=ip. You need to specify the sortDirection parameter if you specify this parameter. This parameter is similar to the sort by parameter in MySQL. | 4.1.0 | |
| sortDirection | String | query | Optional. The sort direction. You need to set this parameter if you specify the sortByparameter. | 4.1.0 | |
| systemTags | List | query | Optional. The system tags. | 4.1.0 | |
| userTags | List | query | Optional. The user tags. | 4.1.0 |
API Response
Sample Response
{
"inventories": [
{
"user": "example",
"hostNum": 10.0,
"licenseType": "Free",
"issuedDate": "2017-01-19 14:31:06",
"managementNodeUuid": "00898b3538e53e70bb7521e54ff80276",
"expired": true
}
],
"total": 1.0
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| total | Long | The total number of historic license authorizations. This parameter is returned if you set count or replyWithCount to true. | 4.1.0 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 4.1.0 |
| inventory | LicenseInventory | See inventory | 4.1.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 4.1.0 |
| description | String | The brief description of the error. | 4.1.0 |
| details | String | The details about the error. | 4.1.0 |
| elaboration | String | The reserved field. Default value: null. | 4.1.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.1.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 4.1.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.1.0 |
| licenseType | String | The license type. | 4.1.0 |
| expiredDate | String | The expired date. | 4.1.0 |
| issuedDate | String | The issued date. | 4.1.0 |
| uploadDate | String | The license update time. | 4.1.0 |
| user | String | The user. | 4.1.0 |
| prodInfo | String | The license product name. | 4.1.0 |
| hostNum | Integer | The number of host. | 4.1.0 |
| cpuNum | Integer | The number of CPUs. | 4.1.0 |
| vmNum | Integer | The number of VM instance. | 4.1.0 |
| expired | boolean | The expired. | 4.1.0 |
| managementNodeUuid | String | The management node UUID. | 4.1.0 |
SDK Sample
Java SDK
GetLicenseRecordsAction action = new GetLicenseRecordsAction();
action.limit = 20.0;
action.start = 0.0;
action.replyWithCount = true;
action.count = false;
action.sortBy = "uploadDate";
action.sortDirection = "desc";
GetLicenseRecordsAction.Result res = action.call();
Python SDK
action = GetLicenseRecordsAction()
action.limit = 20.0
action.start = 0.0
action.replyWithCount = true
action.count = false
action.sortBy = "uploadDate"
action.sortDirection = "desc"
res = action.call()
GetLicenseCapabilities
API Request
URLs
GET zstack/v1/licenses/capabilities
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/licenses/capabilities
Request Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| systemTags | List | query | Optional. The system tags. | 0.6 | |
| userTags | List | query | Optional. The user tags. | 0.6 |
API Response
When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes 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 Sample
Java SDK
GetLicenseCapabilitiesAction action = new GetLicenseCapabilitiesAction();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetLicenseCapabilitiesAction.Result res = action.call();
Python SDK
action = GetLicenseCapabilitiesAction()
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()
DeleteLicense
API Request
URLs
DELETE /v1/licenses/mn/{managementNodeUuid}/actions?uuid={uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/licenses/mn/4a1821df62404868ada349c672e79a5b/actions?uuid=jh34g5uy4g5434i5h45ui93457348
Request Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | Optional. The resource UUID. | 0.6 | |
| managementNodeUuid | String | url | The management node UUID. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes 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 Sample
Java SDK
DeleteLicenseAction action = new DeleteLicenseAction();
action.managementNodeUuid = "a762967a15a14d69833002d91119c493";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteLicenseAction.Result res = action.call();
Python SDK
action = DeleteLicenseAction()
action.managementNodeUuid = "32875f270bfc4bdb842ede0b42ed39a3"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()
ReloadLicense
API Request
URLs
PUT zstack/v1/licenses/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
"reloadLicense": {
"managementNodeUuids": [
"839034e1da8e37a08b67e3a8279a1650",
"7869acf9b8bd34079f14a93751e60810"
]
},
"systemTags": [],
"userTags": []
}
In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"reloadLicense":{"managementNodeUuids":["839034e1da8e37a08b67e3a8279a1650","7869acf9b8bd34079f14a93751e60810"]}}' \
http://localhost:8080/zstack/v1/licenses/actions
Request Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| managementNodeUuid | List | body (contained in the reloadLicense structure) | Optional. The management node UUID. | 0.6 | |
| systemTag | List | body | Optional. The system tags. | 0.6 | |
| userTag | List | body | Optional. The user tags. | 0.6 |
API Response
Sample Response
{
"inventory": {
"licenseRequest": "eyJwcml2YXRlS2V5IjoiLS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLVxuTUlJRWhnSUJBQUtCL0RjMGtxWGl2UmRPTGRWeC8xK1MzMUtaejNQd1dkek9ob3NvY29rU2wwdnBxYzc2cHF1V1xubDNwQ0FWZ01UaG1OUlo1Z05xaVM2MWdvcmY4WkY3eHBGUWd1cms0WjZxVEl3aDc3emo2NEhPMHBmYnpndzFmL1xuMm9Ga3l1N25GQU5wamxMUEpxalYva0xwL3RVeGpqY0w0ZG9TcDY1TGM3a2lrOXY1aTBpeXlYZEs5dWJsTnFNNVxuV2VNNWdFLzdzeG5IZS9TbFY1Nk1UeWtDeUdpbGVMMmwvUFlmQ2JuYUN4ZG9oOERzKzJ2RnpJaFZ3RWwyYkppZ1xuQkptMl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RElFdEZXUzB0TFMwdFhHNGlmUVx1MDAzZFx1MDAzZCJ9",
"expiredDate": "2017-02-05 19:44:21",
"issuedDate": " 2017-01-06 19:44:21",
"user": " example@mevoco.com",
"hostNum": 10.0,
"expired": true
}
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 0.6 |
| inventory | LicenseInventory | See inventory. | 0.6 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| licenseType | String | The license type. | 0.6 |
| licenseRequest | String | The license request. | 0.6 |
| expiredDate | String | The expired date. | 0.6 |
| issuedDate | String | The issued date. | 0.6 |
| user | String | The user. | 0.6 |
| hostNum | Integer | The number of host. | 0.6 |
| cpuNum | Integer | The number of CPUs. | 0.6 |
| availableHostNum | Integer | The number of available host. | 0.6 |
| availableCpuNum | Integer | The number of available CPU. | 0.6 |
| expired | boolean | The expired. | 0.6 |
SDK Sample
Java SDK
ReloadLicenseAction action = new ReloadLicenseAction();
action.managementNodeUuids = asList("839034e1da8e37a08b67e3a8279a1650","7869acf9b8bd34079f14a93751e60810");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ReloadLicenseAction.Result res = action.call();
Python SDK
action = ReloadLicenseAction()
action.managementNodeUuids = [839034e1da8e37a08b67e3a8279a1650, 7869acf9b8bd34079f14a93751e60810]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()
UpdateLicense
API Request
URLs
PUT zstack/v1/licenses/mn/{managementNodeUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
"updateLicense": {
"license": "this is license string"
},
"systemTags": [],
"userTags": []
}
In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateLicense":{"license":"this is license string"}}' \
http://localhost:8080/zstack/v1/licenses/mn/f03b0d69643038f9812edbf4b259cac1/actions
Request Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| managementNodeUuid | String | url | The management node UUID. | 0.6 | |
| license | String | body (contained in the updateLicense structure) | The license content encoded in Base64 format. | 0.6 | |
| additionSession | String | body (contained in the updateLicense structure) | The additional information. The value is a JSON-formatted string. | 4.1.0 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
Sample Response
{
"inventory": {
"licenseRequest": "eyJwcml2YXRlS2V5IjoiLS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLVxuTUlJRWhnSUJBQUtCL0RjMGtxWGl2UmRPTGRWeC8xK1MzMUtaejNQd1dkek9ob3NvY29rU2wwdnBxYzc2cHF1V1xubDNwQ0FWZ01UaG1OUlo1Z05xaVM2MWdvcmY4WkY3eHBGUWd1cms0WjZxVEl3aDc3emo2NEhPMHBmYnpndzFmL1xuMm9Ga3l1N25GQU5wamxMUEpxalYva0xwL3RVeGpqY0w0ZG9TcDY1TGM3a2lrOXY1aTBpeXlYZEs5dWJsTnFNNVxuV2VNNWdFLzdzeG5IZS9TbFY1Nk1UeWtDeUdpbGVMMmwvUFlmQ2JuYUN4ZG9oOERzKzJ2RnpJaFZ3RWwyYkppZ1xuQkptMlU3VzNKZzltWGZEb2dDTHMyMTE4TXdDUGFQVWVMRTArWlBBNUduL2ZxZUZad2hDMElMcnM3ZTZyZThxK1xuVWpBN2RXeVoxVm50Y0xiWGUxbW94Vm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Num": 10.0,
"expired": true
}
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 0.6 |
| inventory | LicenseInventory | See inventory. | 0.6 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| licenseType | String | The license type. | 0.6 |
| licenseRequest | String | The license request. | 0.6 |
| expiredDate | String | The expired date. | 0.6 |
| issuedDate | String | The issued date. | 0.6 |
| user | String | The user. | 0.6 |
| hostNum | Integer | The number of host. | 0.6 |
| cpuNum | Integer | The number of CPUs. | 0.6 |
| availableHostNum | Integer | The number of available host. | 0.6 |
| availableCpuNum | Integer | The number of available CPU. | 0.6 |
| expired | boolean | The expired. | 0.6 |
SDK Sample
Java SDK
UpdateLicenseAction action = new UpdateLicenseAction();
action.managementNodeUuid = "f03b0d69643038f9812edbf4b259cac1";
action.license = "this is license string";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateLicenseAction.Result res = action.call();
Python SDK
action = UpdateLicenseAction()
action.managementNodeUuid = "f03b0d69643038f9812edbf4b259cac1"
action.license = "this is license string"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()
PushLicenseAddOnsUsage
API Request
URLs
PUT zstack/v1/licenses/addons/usage
Headers
Authorization: OAuth the-session-uuid
Body
{
"pushLicenseAddOnsUsage": {
"addOnsUsage": "[{\"usage\":10,\"module\":\"CPU.Zaku\"}]"
},
"systemTags": [],
"userTags": []
}
In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"pushLicenseAddOnsUsage":{"addOnsUsage":"[{\"usage\":10,\"module\":\"CPU.Zaku\"}]"}}' http://localhost:8080/zstack/v1/licenses/addons/usage
Request Parameters
| Name | Type | Location | Description | Valid Values | Starting Version |
|---|---|---|---|---|---|
| addOnsUsage | String | body (contained in the pushLicenseAddOnsUsage structure) | The utilization of each add-on module. | 5.1.8 | |
| systemTags | List | body | Optional. The system tags. | 5.1.8 | |
| userTags | List | body | Optional. The user tags. | 5.1.8 |
API Response
When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes 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 Sample
Java SDK
PushLicenseAddOnsUsageAction action = new PushLicenseAddOnsUsageAction();
action.addOnsUsage = "[{"usage":10,"module":"CPU.Zaku"}]";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
PushLicenseAddOnsUsageAction.Result res = action.call();
Python SDK
action = PushLicenseAddOnsUsageAction()
action.addOnsUsage = "[{"usage":10,"module":"CPU.Zaku"}]"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()
