Example: Retrieving a premium storage license list

Content Platform Tenant Management

Version
9.7.x
File Size
4269 KB
Audience
anonymous
Part Number
MK-95HCPH002-19

Here is a sample GET request that retrieves the current premium storage license information. The request is made using a system-level user account that includes the administrator role.

Request with cURL command line

curl -k -i -H "Accept: application/xml"
    -H "Authorization: HCP YWxscm9sZXM=:04EC9F614D89FF5C7126D32ACB448382"
    "https://admin.hcp.example.com:9090/mapi/storage/licenses?prettyprint"

Request in Python using PycURL

import pycurl
filehandle = open("HCPLic_SN12345_Q0123456789_A10TB_01-01-2021.plk",
  'wb')
curl = pycurl.Curl()
curl.setopt(pycurl.HTTPHEADER, ["Accept: application/xml",
  "Authorization: HCP \
  YWxscm9sZXM=:04EC9F614D89FF5C7126D32ACB448382"])
curl.setopt(pycurl.URL,
  "https://admin.hcp.example.com:9090/mapi/storage/licenses?" +
  "prettyprint")
curl.setopt(pycurl.SSL_VERIFYPEER, 0)
curl.setopt(pycurl.SSL_VERIFYHOST, 0)
curl.setopt(pycurl.WRITEFUNCTION, filehandle.write)
curl.perform()
print curl.getinfo(pycurl.RESPONSE_CODE)
curl.close()
filehandle.close()

Request headers

GET /mapi/storage/licenses?prettyprint HTTP/1.1
Host: admin.hcp.example.com:9090
Accept: application/xml
Authorization: HCP YWxscm9sZXM=:04EC9F614D89FF5C7126D32ACB448382

Response headers

HTTP/1.1 200 OK
Content-Type: application/xml
X-HCP-SoftwareVersion: 9.0.0.2
Content-Length: 356

Response body in XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<licenses>
     <license>
         <activeCapacity>10000000000000</activeCapacity>
         <expirationDate>Jan 1, 2025</expirationDate>
         <extendedCapacity>0</extendedCapacity>
         <licenseType>Premium</licenseType>
         <serialNumber>12345</serialNumber>
         <uploadDate>Aug 14, 2020</uploadDate>
     </license>
</licenses>