Use cURL

cURL is an open source, command-line tool for transferring data with URL syntax, supporting various protocols including HTTPS. The examples in this document use cURL to demonstrate how to access the Session Border Controller (SBC) REST API, but you can use any programming language capable of sending and receiving HTTPS requests.

To use cURL to access the SBC REST API:

  • Enable HTTPS on the SBC webserver. See Enable HTTPS for details.

  • Set the CURL_CA_BUNDLE environment variable to the location of a TLS certificate authority (CA) certificate file or bundle to authenticate against the certificate you installed on the SBC. Alternatively, you can specify the location of your local CA certificate bundle on the command line by using the --cacert option.

    You can download a TLS CA certificate bundle from http://curl.haxx.se/docs/caextract.html or provide your own. For information about CA certificate verification using cURL, see http://curl.haxx.se/docs/sslcerts.html.

  • Invoke cURL and specify one or more of the command-line options defined in the following table.

    cURL Option Description
    --cacert Specifies the location of the CA certificate bundle on the local machine.
    -d, --data @file.xml Identifies the request document, in XML format, on the local machine.
    -H, --header Defines one or more of the following:
    • Content-Type header
    • Accept header
    • Authorization header
    • Authentication header
    -i Displays response header information.
    -u, --user username:password Specifies the user name and password for an account on the SBC. Used only when requesting an authentication token.
    -X Indicates the type of request, such as GET, POST, DELETE, or PUT.

For example:

curl -i -X GET 
    --cacert /path/to/bundle 
    -u <username>:<password> 
    -H <request-header>:<value> 
    https://<IP address>/<path>/<resource-path>

All XML responses contains the following structure:

<response>
  <data/>
  <messages/>
  <links/>
</response>

To reuse the data from one GET request in another request, extract the contents of <data> element.

When appropriate, the <messages> section contains errors or warnings and the <links> section contains links to other REST URIs.