Adding a replication certificate example

Here's a sample PUT request that uploads a replication certificate to the HCP system. The request is made using a system-level user account that includes the administrator role.

Request with cURL command line

curl -k -v -b hcp-api-auth="YWxscm9sZXM=:04EC9F614D89FF5C7126D32ACB448382" -T certificate.txt "https://admin.example.lab.archivas.com:9090/mapi/services/replication/certificates"

Request in Python using PycURL

import pycurl

filehandle = open("certificate.txt", 'wb')
curl = pycurl.Curl()
curl.setopt(pycurl.HTTPHEADER, ["Authorization: HCP \
  YWxscm9sZXM=:04EC9F614D89FF5C7126D32ACB448382"])
curl.setopt(pycurl.URL,
  "https://admin.example.lab.archivas.com:9090/mapi/" +
  "services/replication/certificates")
curl.setopt(pycurl.SSL_VERIFYPEER, 0)
curl.setopt(pycurl.SSL_VERIFYHOST, 0)
curl.setopt(pycurl.CUSTOMREQUEST, "PUT")
curl.perform()
print curl.getinfo(pycurl.RESPONSE_CODE)
curl.close()
filehandle.close()

 

Request headers

PUT /mapi/services/replication/certificates HTTP/1.1
Host: admin.hcp.example.com:9090
Authorization: HCP YWxscm9sZXM=:04EC9F614D89FF5C7126D32ACB448382
Content-Type: application/xml
Content-Length: 1396

Response header

HTTP/1.1 200 OK
Content-Type: application/xml
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-HCP-SoftwareVersion: 7.2.0.352
Content-Length: 0

Trademark and LegalDisclaimer

© 2015 Hitachi Data Systems Corporation. All rights reserved.