Example: Retrieving a replication certificate

Content Platform Tenant Management Help

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

Here's a sample GET request that retrieves a replication certificate from the HCP system. The request is made using a system-level user account that includes the administrator or monitor 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/services/replication/certificates
        ?prettyprint"

Request in Python using PycURL

import pycurl
filehandle = open("certificates.xml", '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/services/replication/certificates")
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/services/replication/cerificates HTTP/1.1
Host: admin.hcp.example.com:9090
Authorization: HCP YWxscm9sZXM=:04EC9F614D89FF5C7126D32ACB448382
Accept: application/xml

Response headers

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

Response body

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<certificates>
    <certificate>
        <expiresOn>2021-12-12T15:35:10-0500</expiresOn>
        <id>server</id>
        <subjectDN>CN=*.example.com, OU=HCP, O=Hitachi, L=Waltham, ST=Massachusetts, C=US</subjectDN>
        <validOn>2016-12-12T15:35:10-0500</validOn>
    </certificate>
</certificates>