Example: Setting the schedule for a replication link

Content Platform Tenant Management Help

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

Here’s the a sample POST request that sets the local and remote schedules for an active/active link named MA-CA. The new schedule is in an XML file named schedule_MA-CA.xml. The request is made using a system-level user account that includes the administrator role.

Request body in XML

<schedule>
    <local>
        <scheduleOverride>NONE</scheduleOverride>
        <transition>
            <time>Sun:00</time>
             <performanceLevel>HIGH</performanceLevel>
        </transition>
        <transition>
            <time>Sun:06</time>
            <performanceLevel>MEDIUM</performanceLevel>
        </transition>
        <transition>
             <time>Sat:00</time>
             <performanceLevel>HIGH</performanceLevel>
        </transition>
        <transition>
             <time>Sat:06</time>
             <performanceLevel>MEDIUM</performanceLevel>
        </transition>
    </local>
    <remote>
        <scheduleOverride>NONE</scheduleOverride>
        <transition>
             <time>Sun:00</time>
             <performanceLevel>HIGH</performanceLevel>
        </transition>
        <transition>
             <time>Mon:00</time>
             <performanceLevel>MEDIUM</performanceLevel>
        </transition>
    </remote>
</schedule>

Request with cURL command line

curl -k -i -d @schedule_MA-CA.xml
    -H "Authorization: HCP YWxscm9sZXM=:04EC9F614D89FF5C7126D32ACB448382"
    "https://admin.hcp-ma.example.com:9090/mapi/services/replication/links/
         MA-CA/schedule"

Request in Python using PycURL

import pycurl
import os
filehandle = open("schedule_MA-CA.xml", 'rb')
curl = pycurl.Curl()
curl.setopt(pycurl.HTTPHEADER, ["Content-Type: application/xml",
  "Authorization: HCP \
  YWxscm9sZXM=:04EC9F614D89FF5C7126D32ACB448382"])
curl.setopt(pycurl.URL,
  "https://admin.hcp-ma.example.com:9090/mapi/services/" +
  "replication/links/MA-CA/schedule")
curl.setopt(pycurl.SSL_VERIFYPEER, 0)
curl.setopt(pycurl.SSL_VERIFYHOST, 0)
curl.setopt(pycurl.UPLOAD, 1)
curl.setopt(pycurl.CUSTOMREQUEST, "POST")
curl.setopt(pycurl.INFILESIZE,
  os.path.getsize("schedule_MA-CA.xml"))
curl.setopt(pycurl.READFUNCTION, filehandle.read)
curl.perform()
print curl.getinfo(pycurl.RESPONSE_CODE)
curl.close()
filehandle.close()

Request headers

POST /mapi/services/replication/links/MA-CA/schedule HTTP/1.1
Host: admin.hcp-ma.example.com:9090
Authorization: HCP YWxscm9sZXM=:04EC9F614D89FF5C7126D32ACB448382
Content-Type: application/xml
Content-Length: 807

Response headers

HTTP/1.1 200 OK
X-HCP-SoftwareVersion: 9.0.0.2
Content-Length: 0