Use cURL

The examples within this document use cURL to demonstrate how to access the Oracle Service Cloud REST APIs. cURL is an open source, command-line tool for transferring data with URL syntax, supporting various protocols including HTTP and HTTPS.

Step 1: Install cURL

To connect securely to the REST server, you must install a version of cURL that supports SSL.

To install cURL on your system:

  1. In your browser, navigate to the cURL home page and click Download in the navigation menu.
  2. On the 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 extract the executable to the desired folder.

For more information, see Installing the cURL Command-Line Tool on Windows.

Step 2: Set Environment Variable for cURL

When running cURL from a Windows command shell, you must provide an SSL certificate authority (CA) file or bundle to authenticate against the Verisign CS certificate.

  1. Navigate to the cURL CA Extract page and download the cacert.pem SSL CA certificate file in the same folder where you installed cURL.
  2. 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 the SSL CA certificate file. For example, on a Windows system you would enter:

    C:\curl> set CURL_CA_BUNDLE=cacert.pem

You are now ready to send REST requests to the Oracle Service Cloud instance using cURL.

Step 3: Invoke cURL

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

Specifies the request body, or data, either directly or by referring to a JSON file on the local machine.

-F, --form @file.json

Specifies form data, either directly or by referring to a JSON file on the local machine.

-H

Defines a request header.

-I

Displays response header information.

-u, ?user

Specifies the user name and password for the Oracle Service Cloud account.

-X

Indicates the type of request (for example, GET, POST, and so on).

Note:

For more information, see Send Requests.