Hello World with cURL

This tutorial tested with CUCM versions: 8.5/12.5

cURL is a an open source, cross-platform tool able to perform URL-based network requests from the comamnd line: https://curl.haxx.se/

cURL can be used, among other things, to make HTTP requests, including SOAP requests. In this example, the XML for the actual AXL SOAP request is stored in a file on the local system, called request.xml

Here are the contents:

request.xml

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/12.5">
    <soapenv:Header/>
    <soapenv:Body>
    <ns:executeSQLQuery>
        <sql>Select name from device where tkclass = 1</sql>
    </ns:executeSQLQuery>
    </soapenv:Body>
</soapenv:Envelope>

Note: be sure to updte the xmlns:ns namespace URL to reflect the AXL version you will be making the request to

This XML could be replaced with any valid AXL request XML.

The cURL command is executed in the same directory as the request.xml file.

$ curl -k -u AXLuser -H 'Content-type: text/xml' -H 'SOAPAction: "CUCM:DB ver=12.5 executeSQLQuery"' -d @request.xml https://CUCM-ADDRESS:8443/axl/

Note: be sure to replace AXLUser with your actual AXL username (e.g. the system Admininistrator account), and CUCM-ADDRESS with the actual address of the CUCM you will be making the request to.

Also, update the SOAPAction header to reflect the target AXL version.

The parameters given are as follows:

  • -k : Disable HTTPS key authentication for the AXL server.

  • -u : The HTTP Basic Auth user name, i.e. the AXL user name. This should be a CUCM user with AXL access role.

  • -H : Header. Two header entries are given, one to override cURL's default Content-Type to reflect text/xml, and the other to specify the AXL version via the SOAPAction header.

  • -d : Specifies the data file where the data to be sent is stored, i.e. request.xml

  • The final parameter is the AXL URL on the target CUCM server