Use cURL

You can use cURL to access the Oracle IoT Cloud Service REST API.

Install cURL

To connect securely to the server, you must install a version of cURL that supports SSL and also provide an SSL certificate authority (CA) certificate file or bundle to authenticate against the Verisign CA certificate.

The following procedure demonstrates how to install SSL-enabled cURL in your system:
  1. In your browser, navigate to the cURL home page at http://curl.haxx.se and click Download in the left navigation menu.

  2. On the cURL Releases and Downloads page, locate the SSL-enabled version of the cURL software that corresponds to your operating system, click the link to download the ZIP file, and install the software.

  3. Navigate to the cURL CA Certs page at http://curl.haxx.se/docs/caextract.html and download the ca-cert.pem SSL CA certificate bundle in the folder where you installed cURL.

  4. Open a command window, navigate to the directory where you installed cURL, and set the cURL environment variable, CURL_CA_BUNDLE, to the location of an SSL certificate authority (CA) certificate bundle. For example:

    C:\curl> set CURL_CA_BUNDLE=ca-cert.pem

To use cURL to access the Oracle IoT Cloud Service REST API:

  • Invoke cURL and specify one or more of the command-line options defined in the following table, as required, to direct its execution

    cURL Option Description
    -d, --data @file.json Identifies the request document, in JSON format, on the local machine. Alternatively you can provide the data in JSON format after the -d option.
    -F, --form <name=content> Identifies form data, in JSON format, on the local machine.
    -H Defines one or both of the following:
    • Content type of the request document

    • Custom header, X-ID-TENANT-NAME, to identify the identity domain

    -i Displays response header information.
    -u, --user username:password Specifies the user name and password for the <ProductName> account.
    -X Indicates the type of request (for example, GET, POST, and so on).

For example:

curl -i -X GET -u <username>:<password> -H <request-header>:<value> http://<subdomain>.<domain>.com/<path>/<resource-path>