Prepare to Use the REST API

Before you use the REST API, complete the following preparatory steps:

  1. Install cURL.

    Note:

    You can access the REST API from any application or programming platform that correctly and completely understands the Hypertext Transfer Protocol (HTTP) and has Internet connectivity.

    cURL is a command-line tool that you can use to invoke REST API calls by sending HTTP requests. The examples in this document use the cURL command-line tool to demonstrate how to access the Compute Classic REST API.

    cURL is available by default on most UNIX-like hosts.

    To install cURL on Windows, complete the following steps:

    1. In your browser, navigate to http://curl.haxx.se/download.html.

    2. 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. From http://curl.haxx.se/docs/caextract.html, download the ca-bundle.pem certificates bundle in the directory where you installed cURL.

    4. At the command prompt, go to the directory where you installed cURL, and set the cURL environment variable, CURL_CA_BUNDLE, to the location of the certificates bundle that you downloaded.

      For example:

      C:\curl> set CURL_CA_BUNDLE=ca-bundle.pem
  2. Find out the REST endpoint URL for your service.
    1. Sign in to Oracle Cloud My Services, using the My Services URL from the welcome email.

    2. Click Menu icon near the upper left corner of the page.

    3. In the menu that appears, expand Services, and click Compute Classic.

      The Instances page of the Compute Classic web console is displayed.

    4. Click Site near the top of the page, and select the site for which you want to find out the REST endpoint URL.

    5. In the Site Selector dialog box that is displayed, note the URL in the REST Endpoint field.

  3. Identify the two-part user name.

    The user name that you must use for REST API calls to Compute Classic is a special two-part name in the format: /Compute-serviceInstanceID/username

    username is the user name that you use to sign in to My Services.

    To find out the service instance ID:

    1. Sign in to the Oracle Cloud My Services. The Oracle Cloud My Services Dashboard page is displayed. It lists the services available in your account.

    2. In the Compute service tile, click Compute. The service details page for Compute Classic is displayed.

    3. Under Additional Information, locate the Service Instance ID field and note the value displayed.

      For example, if your service instance ID is 575260584 and the user name in your account-creation email is jack.jones@example.com, then use the following two-part user name for REST API calls:

      /Compute-575260584/jack.jones@example.com