Example: Retrieving a list of retention classes

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 list of the retention classes defined for the Accounts-Receivable namespace. The request writes the list of retention classes to a file named AR-retclasses.xml. The request is made using a tenant-level user account that includes the compliance role.

Request with cURL command line

curl -k -H "Accept: application/xml"
    -H "Authorization: HCP bXdoaXRl:ad49ce36d0cec9634ef63b24151be0fb"
    "https://finance.hcp.example.com:9090/mapi/tenants/finance/namespaces/
         accounts-receivable/retentionClasses?prettyprint" > AR-retclasses.xml

Request in Python using PycURL

import pycurl
filehandle = open("AR-retclasses.xml", 'wb')
curl = pycurl.Curl()
curl.setopt(pycurl.HTTPHEADER, ["Accept: application/xml",
  "Authorization: HCP \
  bXdoaXRl:ad49ce36d0cec9634ef63b24151be0fb"])
curl.setopt(pycurl.URL,
  "https://finance.hcp.example.com:9090/mapi/tenants/finance/" +
  "namespaces/accounts-receivable/retentionClasses?prettyprint")
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/tenants/finance/namespaces/accounts-receivable/retentionClasses
    ?prettyprint HTTP/1.1
Host: finance.hcp.example.com:9090
Authorization: HCP bXdoaXRl:ad49ce36d0cec9634ef63b24151be0fb
Accept: application/xml

Response headers

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

Response body in XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<retentionClasses>
    <name>FN-Std-37</name>
    <name>FN-Std-42</name>
</retentionClasses>