Example Configuring the HTTP protocol for an HCP namespace
Here’s a sample POST request that configures the HTTP protocol for the Accounts-Receivable namespace. The new settings are in an XML file named AR-http.xml. The request is made using a tenant-level user account that includes the administrator role.
Request body in XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <httpProtocol> <httpsEnabled>true</httpsEnabled> <httpEnabled>false</httpEnabled> <restEnabled>true</restEnabled> <restRequiresAuthentication>true</restRequiresAuthentication> <httpActiveDirectorySSOEnabled>true</httpActiveDirectorySSOEnabled> <ipSettings> <allowAddresses> <ipAddress>192.168.140.10</ipAddress> <ipAddress>192.168.140.14</ipAddress> <ipAddress>192.168.140.15</ipAddress> <ipAddress>192.168.149.0/24</ipAddress> </allowAddresses> <allowIfInBothLists>false</allowIfInBothLists> <denyAddresses> <ipAddress>192.168.149.5</ipAddress> </denyAddresses> </ipSettings> </httpProtocol>
Request with cURL command line
curl -k -i -d @AR-http.xml -H "Content-Type: application/xml" -H "Authorization: HCP bGdyZWVu:a3b9c163f6c520407ff34cfdb83ca5c6" "https://finance.hcp.example.com:9090/mapi/tenants/finance/namespaces/ accounts-receivable/protocols/http"
Request in Python using PycURL
import pycurl import os filehandle = open("AR-http.xml", 'rb') curl = pycurl.Curl() curl.setopt(pycurl.HTTPHEADER, ["Content-Type: application/xml", "Authorization: HCP \ bGdyZWVu:a3b9c163f6c520407ff34cfdb83ca5c6"]) curl.setopt(pycurl.URL, "https://finance.hcp.example.com:9090/mapi/tenants/finance/" + "namespaces/accounts-receivable/protocols/http") 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("AR-http.xml")) curl.setopt(pycurl.READFUNCTION, filehandle.read) curl.perform() print curl.getinfo(pycurl.RESPONSE_CODE) curl.close() filehandle.close()
Request headers
POST /mapi/tenants/finance/namespaces/accounts-receivable/protocols/http HTTP/1.1 Host: finance.hcp.example.com:9090 Authorization: HCP bGdyZWVu:a3b9c163f6c520407ff34cfdb83ca5c6 Content-Type: application/xml Content-Length: 285
Response headers
HTTP/1.1 200 OK Content-Type: application/xml X-HCP-SoftwareVersion: 9.0.0.2 Content-Length: 0