Send Requests

Use the following guidelines when sending requests using the Oracle Application Container Cloud REST API for caching applications.

Host Environment Variable and URL Structure

To access a cache, your application must be able to read the CACHING_INTERNAL_CACHE_URL environment variable at runtime.

This variable contains what is effectively the hostname of the cache service. Your application uses this variable to construct the URL for communicating with the cache. The hostname format is cache-service-name-acc.

The REST API for caching applications uses port 8080.

Reading the environment variable in a Java application involves code like this:

public static final String CACHEHOST;
public static final String CACHEPORT = "8080";
public static final String CACHEURL;
static {
   CACHEHOST = System.getenv("CACHING_INTERNAL_CACHE_URL");
   if (CACHEHOST == null){
      System.out.println("CACHING_INTERNAL_CACHE_URL not set");
      System.exit(0);
   }
   CACHEURL = "http://" + CACHEHOST + ":" + CACHEPORT + "/ccs/";
}

Supported Methods

You can perform operations on Oracle Application Container Cloud caches using standard HTTP method requests, as summarized in the following table.

This table describes the HTTP methods supported in the Oracle Application Container Cloud REST API for caching applications.
HTTP Method Description
GET Retrieve values from the cache or cache metrics.
POST Store, replace, or remove values in the cache.
PUT Store values in the cache.
DELETE Delete a key from the cache or clear the cache.

Media Types

The following media types are supported by the REST API:

  • application/json

  • application/octet-stream

Supported Headers

The REST API supports the following headers that may be passed in the header section of the HTTP request or response.

This table describes the HTTP request and response headers supported in the Oracle Application Container Cloud REST API.
Header Description Example
Content-Type Media type of the body of the request. Required for POST and PUT requests. Content-Type: application/octet-stream
Accept Media type of the body of the response. Accept: application/json
X-Method Method to invoke for a POST request. X-Method: putIfAbsent