获取许可证历史授权信息

GET/zstack/v1/licenses/records

Curl示例

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

参数列表

名字类型位置描述可选值起始版本
limit (可选)Integerquery最多返回的记录数,类似MySQL的limit,默认值20 4.1.0
start (可选)Integerquery起始查询记录位置,类似MySQL的offset。跟limit配合使用可以实现分页 4.1.0
replyWithCount (可选)booleanquery计数查询,查询是否附加返回数据记录数。当设置成true时,API在返回数据记录的同时返回满足查询条件的记录数 4.1.0
count (可选)booleanquery计数查询,相当于MySQL中的count()函数。当设置成true时,API只返回的是满足查询条件的记录数 4.1.0
sortBy (可选)Stringquery以字段排序,等同于MySQL中的sort by关键字,例如sortBy=ip。必须跟sortDirection配合使用 4.1.0
sortDirection (可选)Stringquery字段排序方向,必须跟sortBy配合使用 4.1.0
systemTags (可选)Listquery系统标签 4.1.0
userTags (可选)Listquery用户标签 4.1.0

API返回

返回示例

{
  "inventories": [
    {
      "user": "example",
      "hostNum": 10.0,
      "licenseType": "Free",
      "issuedDate": "2017-01-19 14:31:06",
      "managementNodeUuid": "00898b3538e53e70bb7521e54ff80276",
      "expired": true
    }
  ],
  "total": 1.0
}
名字类型描述起始版本
totalLong许可证历史授权数据总量。如果设置count或replyWithCount为true则返回该值4.1.0
errorErrorCode错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error4.1.0
inventoryLicenseInventory详情参考inventory4.1.0

error

名字类型描述起始版本
codeString错误码号,错误的全局唯一标识,例如SYS.1000, HOST.10014.1.0
descriptionString错误的概要描述4.1.0
detailsString错误的详细信息4.1.0
elaborationString保留字段,默认为null4.1.0
opaqueLinkedHashMap保留字段,默认为null4.1.0
causeErrorCode根错误,引发当前错误的源错误,若无原错误,该字段为null4.1.0

inventory

名字类型描述起始版本
uuidString 4.1.0
licenseTypeString 4.1.0
expiredDateString 4.1.0
issuedDateString 4.1.0
uploadDateString许可证上传时间4.1.0
userString 4.1.0
prodInfoString许可证产品名称4.1.0
hostNumInteger 4.1.0
cpuNumInteger 4.1.0
vmNumInteger 4.1.0
expiredboolean 4.1.0
managementNodeUuidString 4.1.0

SDK示例

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

GetLicenseRecordsAction action = 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()