Try Out the APIs

As a developer who plans to integrate with the REST API for Sites Management, the first thing you will probably want to do is experiment by making a few requests. To do this, you can make some requests manually using the curl command-line tool.

The REST API for Sites Management requires authentication using OAuth, so you will need to obtain an OAuth token first. You can use curl to access the REST APIs and must use OAuth for authentication. For details, see Integrate with Oracle Content Management Using OAuth.

Install curl

You can use the curl command-line tool to access the REST API for Sites Management. To connect securely to the Oracle Content Management server, you must install a version of curl that supports SSL and provide an SSL certificate authority (CA) certificate file or bundle to authenticate against the Verisign CA certificate.

The following procedure describes how to install curl on a Windows 64 bit system:

  1. In your browser, navigate to the curl home page at https://curl.haxx.se, click Download, and follow the instructions to download curl.

  2. On the curl Releases and Downloads page, 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. Navigate to the curl CA Certs page at https://curl.haxx.se/docs/caextract.html, and download the SSL CA certificate bundle to the directory where you installed curl.

  4. Open a command window, navigate to the directory where you installed curl, and set the curl environment variable, CURL_CA_BUNDLE, to the location of an SSL certificate authority (CA) certificate bundle:

    C:\curl> set CURL_CA_BUNDLE=ca-bundle.crt

You are now ready to send requests to Oracle Content Management using curl.

Use OAuth

Setting up your request to use OAuth is a two-step process. First, you obtain an OAuth token, and then you use this token to access the REST API.

  1. From the command line, enter this URL:

    curl -X POST \
    https://<IDCS BaseURL>/oauth2/v1/token \
    -H 'Authorization: Basic <Base64 encoded clientID:clientSecret>' \
    -H 'Host: <idcs hostname>' \
    -d 'grant_type=client_credentials&scope=https%3A%2F%<ServiceInstanceBaseURL>%3A443%2Furn%3Aopc%3Acec%3Aall'

    The documents/web context is protected by Oracle Identity Cloud Services (IDCS). The user will be prompted to sign in to IDCS unless there is already a valid IDCS session in the browser.

    The OAuth token is returned in the tokenValue field in the JSON response. The token expiration time is given in seconds, and is typically 7 days.

  2. To use the token and access sites management REST API endpoints, use the Bearer Authorization header; for example:

    curl -i -H 'Authorization: Bearer token' --request GET
    
    https://Oracle-Content-Management-URL/sites/management/api/v1/sites