cURL Examples

The examples that demonstrate how to access the Lifecycle Management REST endpoints for Oracle API Platform Cloud Service - Classic using cURL.

For information about downloading and installing cURL, see http://curl.haxx.se/download.html. You must install a version of cURL that supports SSL.

Once installed, to use cURL to access the Lifecycle Management REST endpoints for Oracle API Platform Cloud Service - Classic:

  • Set the CURL_CA_BUNDLE environment variable to the location of an SSL certificate authority (CA) certificate file or bundle to authenticate against the Verisign CA certificate. Alternatively, you can specify the location of your local CA certificate bundle on the command line by using the --cacert option.

    You can download an SSL CA certificate bundle from http://curl.haxx.se/docs/caextract.html or provide your own. For information about CA certificate verification using cURL, see: http://curl.haxx.se/docs/sslcerts.html.

  • Specify one or more of the following command-line options, as required, to direct the execution of cURL:

    cURL Option Description

    --cacert

    Specifies the location of the CA certificate bundle on the local machine.

    --data (-d)

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

    --header (-H)

    Defines a request header.

    --include (-i)

    Displays response header information.

    --method (-X)

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

For more information about authentication requirements, see Security, Authentication and Authorization.

For example:

curl -i -X POST 
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX3R6IjoiQW1lcmljYS9DaGljYWdvIiwic3ViIjoiW1wbGUiLCJ0ZW5hbnQiOiJzYW1wbGUiLCJqdGkiOiJzYW1wbGUifQ"
-H "Content-Type: application/vnd.com.oracle.oracloud.provisioning.Service+json"
-d @<payload.json>
https://<psm_host>:<psm_port>/paas/api/v1.1/instancemgmt/{identityDomainID}/services/APICS/instances

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 - Classic user with authorization to perform the requested operation. This header looks like:

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