Install and Use cURL

You can use cURL to access the Oracle Communications UTIA REST API from the command line, as shown in the examples throughout this document.

Task 1: Install cURL

Download and install the SSL-enabled version of cURL for your operating system from: http://curl.haxx.se/download.html.

Install the CA Certificate and Set the Environment Variable for cURL

To run cURL from a command shell, you must provide an SSL certificate authority (CA) file or bundle to authenticate against the Verisign CS certificate:

  1. Go to the cURL CA certifications page:

    http://curl.haxx.se/docs/caextract.html

  2. Download the cacert.pem CA certificate bundle to the folder where you installed cURL.

  3. At the command line, go to the directory where you installed cURL.

  4. Set the cURL environment variable, CURL_CA_BUNDLE, to the location of cacert.pem. For example:

    C:\curl> set CURL_CA_BUNDLE=cacert.pem

For information about CA certificate verification using cURL, see:

http://curl.haxx.se/docs/sslcerts.html

Task 3: Use cURL

Use cURL at the command line to access the UTIA REST API.

You can invoke cURL with one or more of these command-line options:

cURL Option Description
-d, --data

Specifies the body of the POST request.

For short requests, such as a POST request to create a telephone number without any relationship, you can include the body data in JSON format directly in the request.

For long requests, such as creating a logical device with many relationships, use -d @file.json , where file is a JSON document on your local system that contains your request body. The examples in this document use this option, regardless of length.

-H, --Header

Specifies the headers to use, which define the content type and authorization details.

See "Supported Methods" for more information.

-i Specifies that the response should include header information.
-X, --request Specifies the type of request: GET, POST, PATCH, PUT, or DELETE.

For example, the cURL command to create a telephone number might look like:

curl --location --request POST 'https://hostname:port/topology/v2/vertex/' --cacert $OAM_CNTK/certs/oamappcert.pem --header 'Content-Type: application/json' --header 'Cookie: _fb847=dc866db426b6ffb6' --header 'Authorization: Bearer <bearer value>' --data '{
        "businessObjectClass": "LogicalDeviceDAO",
        "name": "INGL01CA.MC-1.LD1",
        "id": "INGL01CA.MC-1-1",
        "referenceId": 4275601,
        "specName": "GenericDevice",
        "inventoryStatus": "INSTALLED",
        "latitude": 33.9866,
        "longitude": -118.3844,
        "geometry": {
            "gtype": 1,
            "dim": 2,
            "srid": 8309
        }
    }'
where:
  • hostname is the URL for your UTIA REST server.
  • port is the port for your UTIA REST server.
  • version is the version of the API you're using, such as v1. See "Versioning".
  • access token is the generated token to access the REST APIs using OAuth2 authentication. See "Authentication and Authorization".

The methods described in this document include examples of cURL requests and the corresponding JSON responses.