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 -H "Content-Type: text/html" -H "Authorization=HCP YWxscm9sZXM=:04ec9f614d89ff5c7126d32acb448382" -X PUT -d "450a4346cac1d4d49c719312caed27f4f582ba1024b342a0f10be7a7283e6f8acba69e5c" "https://admin.hcp.example.com:9090/mapi/storage/licenses"
Request in Python using PycURL
import pycurl import os readString = "450a4346cac1d4d49c719312caed27f4f582ba1024b342a0f10be7a7283e6f8acba69e5c", curl = pycurl.Curl() curl.setopt(curl.HTTPHEADER, ["Content-Type: text/html", "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.CUSTOMREQUEST, "PUT") curl.setopt(pycurl.POSTFIELDS, readString) curl.perform() print curl.getinfo(pycurl.RESPONSE_CODE) curl.close() filehandle.close()
Request headers
PUT /mapi/services/replication/links HTTP/1.1 Host: admin.hcp.example.com:9090 Authorization: HCP YWxscm9sZXM=:04EC9F614D89FF5C7126D32ACB448382 Content-Type: text/html
Response headers
HTTP/1.1 200 OK Content-Type: application/xml X-HCP-SoftwareVersion: 9.0.0.2 Content-Length: 0