This blog is an introduction to show developers how to retrieve a list of customers from the XML API.

Refer to the XML API documentation to view a comprehensive guide with samples to programmatically communicate with the API.

Getting Started

The solution is a single-page application using HTML and jQuery to POST a request to the XML API using basic authentication.

Code Sample

The following code sample uses jQuery to send a request to the XML API that will retrieve a list of all the customers:

   type: "POST",
   url: "https://cortexweb/CortexAPI/Default.aspx",
   contentType: "text/xml",
   dataType: 'text',
   async: false,
   username: "cspadmin_csp",
   password: "Password123",
   data: '<?xml version="1.0" encoding="utf-8"?>' +
          '<request action="FIND" version="1.0">' +
           '<customer/>' +

Here is a screenshot of the request screen (request.html):

XML Request

<?xml version="1.0" encoding="utf-8"?>
<request action="FIND" version="1.0">

XML Response
<?xml version="1.0" encoding="utf-8"?>
<response version="1.0">
    <fullname>Cortex Service Provider</fullname>
    <billingid />
    <billingid />


Click here to download the single-page application.

Converting XML to JSON

If you prefer to work with JSON results instead of XML then I would suggest trying a jQuery XML to JSON plugin to covert the XML response to JSON.

For example:

  function (data) {
    var jsonData = $.xml2json(data);


Cross site domains

Make sure that the solution is deployed in the domain to avoid cross site domain or cross site scripting errors.   The following line was added to the code sample to enable cross domain requests:

// Enable cross-domain requests (Header: Access-Control-Allow-Origin)
$.support.cors = true;

Certificate Errors

The solution doesn’t work over SSL/HTTPS unless a valid certificate is configured for the XML API web service.

Browser Support

The solution was tested using Internet Explorer and Chrome.

If you are getting the “NetworkError: A network error occurred.” error from Chrome then try to deploy the request.html file to your API folder, such as “C:\inetpub\Cortex Management\CortexAPI”.