Use cURL

The examples within this document use cURL to demonstrate how to access the APIs.

To use cURL to access the APIs:

  • Install cURL.

  • In a command window, set the cURL environment variable, CURL_CA_BUNDLE, to the location of your local CA certificate bundle. 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, as required, to direct its execution.

    cURL Option Description

    Oracle-Mobile-Backend-ID

    The mobile backend ID. When you use Basic authentication, this header must be defined for each call. All mobile apps associated with a mobile backend use the same mobile backend ID.

    -d, --data '{"name":"value"}'

    -d, --data @file.json

    Identifies the request data, in JSON format, on the local machine.

    -F, --form @file.json

    Identifies form data, in JSON format, on the local machine.

    -H, --header

    Defines a header to include in the request.

    -i

    Displays response header information.

    -u, --user username:password

    Specifies the user name and password.

    -X, --request

    Indicates the type of request (for example, GET, POST, and so on). The default if this option is omitted is GET.

The following example cURL command returns the metadata about a storage collection:
curl -i
-X GET 
-u mobile.user@example.com:Welcome1!
-H "Oracle-Mobile-Backend-ID: ABCD9278-091f-41aa-9cb2-184bd0586fce"
https://fif.cloud.oracle.com/mobile/platform/storage/collections/technicianNotes

The examples in this reference use Basic authorization. For information about authorization, see Authorization.

Install cURL

The examples within this document use the cURL command-line tool to demonstrate how to access the APIs.

The following procedure demonstrates how to install cURL on a Windows 64-bit 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-bundle.crt 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-bundle.crt