Send Requests

Use these guidelines when sending requests using the Oracle Java Cloud Service REST API.

URL Structure

Use the following URL structure to access the Oracle Java Cloud Service REST endpoints:

https://rest_server/endpoint-path
Where:
  • endpoint-path is the relative path that defines the REST resource. For a complete list of REST endpoints, see All REST Endpoints.

  • rest_server is the REST server to contact for your identity domain or Cloud Account.

    To find the server name:
    1. Sign in to the My Services dashboard for your identity domain or Cloud Account.

    2. In the list of services, click Java.

    3. Locate the REST Endpoint field, which shows the URL to the REST server.

    The value depends on the default data region of your cloud account. For example:

    • https://jaas.oraclecloud.com/
    • https://psm.us.oraclecloud.com/
    • https://jcs.emea.oraclecloud.com/
    • https://psm.europe.oraclecloud.com/
    • https://psm.brcom-central-1.oraclecloud.com/
    • https://psm.aucom.oraclecloud.com/

    If you do not have access to the My Services dashboard, get the REST server URL from your Oracle Cloud Account administrator.

    Note: When using Oracle Identity Cloud Service OAuth authentication with Oracle Java Cloud Service, the REST server is the Primary Audience value in the associated Identity Cloud Service application PSM App for API OAuth. See Obtain and Use an OAuth Token.

Request Methods

You can perform basic CRUD operations (create, read, update, and delete) on a resource by using standard HTTP methods, as summarized in the following table.

HTTP Method Description
POST Create, stop, start, scale out, backup, or restore an Oracle Java Cloud Service instance.
GET Retrieve information about an Oracle Java Cloud Service instance or a service instance component.
PUT Delete an Oracle Java Cloud Service instance or update a service instance, for example, scale in or apply a patch.
DELETE Delete an Oracle Java Cloud Service instance component, for example, delete a backup.

Request Media Types

Unless specified otherwise, the Oracle Java Cloud Service REST API supports application/json.

Headers

The Oracle Java Cloud Service REST API supports headers that may be passed in the header section of an HTTP request or response.

Header Description and Example

Accept

Media type for the response body. Note that unless an operation specifies otherwise, the type is application/json.

Example:

Accept:application/json

Content-Type

Media type of the request body. Required for POST and PUT requests.

Examples:

Content-Type:application/json

Content-Type:application/vnd.com.oracle.oracloud.provisioning.Service+json

X-ID-TENANT-NAME

Identity domain ID of the Oracle Java Cloud Service instance. Must be supplied for authentication.

Example:

X-ID-TENANT-NAME:ExampleIdentityDomain

Authorization

How to validate the Oracle Cloud account user, using HTTP Basic or OAuth 2.0 authentication.

  • Authenticate with HTTP Basic

    If you are not using Oracle Identity Cloud Service to authenticate users, specify the user name and password of the Oracle Cloud user in the form:

    Basic base64-encoded-username-colon-password

    Where base64-encoded-username-colon-password is the Base64 encoding of the user name and password separated by a colon.

    Many client applications provide a method that creates this header for you. In cURL, for example, the -u (--user) option adds the Basic Authorization header to a request.

    Suppose the user name and password string to encode is:

    username:password

    The resulting Authorization header would look similar to this:

    Authorization: Basic abcvZTphYmMxMjM=

  • Authenticate with OAuth 2.0

    If you are using Oracle Identity Cloud Service to authenticate users, specify the access token in the form:

    Bearer token-string-of-letters-and-numbers

    Access tokens are very long strings. The following example has been truncated:

    Bearer eyJ4NXQjUzI1Ni......VkdVAZrb_fw

    You obtain the access token by using the Identity Cloud Service Access Token URL with a client ID, a client secret, an appropriate scope and the password grant type (user name and password for the Oracle Cloud user). See Obtain and Use an OAuth Token.