Here’s a sample PUT request that uploads a storage license. The request is made using a system-level user account that includes the administrator role.
Request with cURL command line
curl -i -k -T HCPLic_SN12345_Q0123456789_A10TB_01-01-2018.plk
-H "Authorization: HCP YWxscm9sZXM=:04EC9F614D89FF5C7126D32ACB448382" https://admin.hcp.example.com:9090/mapi/storage/licenses
Request in Python using PycURL
import pycurl
import os
filehandle = open("HCPLic_SN12345_Q0123456789_A10TB_01-01-2018.plk", 'wb')
curl = pycurl.Curl()
curl.setopt(pycurl.HTTPHEADER, ["Content-Type: application/xml",
"Authorization: HCP \
YWxscm9sZXM=:04EC9F614D89FF5C7126D32ACB448382"])
curl.setopt(pycurl.URL,
"https://admin.hcp.example.com:9090/mapi/storage/licenses”)
curl.setopt(pycurl.SSL_VERIFYPEER, 0)
curl.setopt(pycurl.SSL_VERIFYHOST, 0)
curl.setopt(pycurl.UPLOAD, 1)
curl.setopt(pycurl.INFILESIZE, os.path.getsize("HCPLic_SN12345_Q0123456789_A10TB_01-01-2018.plk"))
curl.setopt(pycurl.READFUNCTION, filehandle.read)
curl.perform()
print curl.getinfo(pycurl.RESPONSE_CODE)
curl.close()
filehandle.close()
Request header
PUT /mapi/services/replication/links HTTP/1.1
Host: admin.hcp.example.com:9090
Authorization: HCP YWxscm9sZXM=:04EC9F614D89FF5C7126D32ACB448382
Content-Type: application/xml
Content-Length: 356
Response header
HTTP/1.1 200 OK
Content-Type: application/xml
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-HCP-SoftwareVersion: 7.1.0.251
Content-Length: 0
© 2017 Hitachi Data Systems Corporation. All rights reserved.