Use cURL

The examples within this document use cURL to demonstrate how to access the REST API for the Management Service in Oracle API Platform Cloud Service.

To use cURL to access the REST API for the Management Service in Oracle API Platform Cloud Service:

  • Install cURL, as described in Quick Start.

  • 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
    -d, --data @file.json

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

    -H "Content-Type: application/json"

    Defines one or both of the following:

    • Content type of the request document

    • Custom headers

    -i

    Displays response header information.

    -H "Authorization: Bearer access_token"

    Specifies the access token for the Oracle API Platform Cloud Service account. For more information, see Authentication.

    -X

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

For example:

curl -i -X POST 
-H "Authorization: Bearer access_token" 
-H "Content-Type: application/json"
-d @api.json
https://example.com/apiplatform/management/v1/apis

Note:

In releases prior to 18.2.5, the REST endpoints were protected using Basic Authorization instead of OAuth. If you are using an earlier version, you must specify an Authorization header whose value contains the base 64-encrypted user name and password (separated by a colon) of an Oracle API Platform Cloud Service user with authorization to perform the requested operation. This header looks like:

Authorization: Basic base64-encrypted-username:base64-encrypted-password