Configuration & Test of OCI Credentials in APEX

Configuration & Test of OCI Credentials in APEX

If you want to use the OCI APIs in APEX, you'll need to create OCI Credentials. Here is a step-by-step guide.

These instructions also correctly place the files in an .oci folder for future use by apps such as CLI Tools

Setup OCI key

  1. Window Key + R% and type %USERPROFILE%

    If you are in unix, you want to navigate to your home folder

  2. Create an .oci folder

  3. In OCI, Click Profile > My Profile

  4. Click API Keys > Add API Key > Download API Key

  5. Don't touch anything in OCI yet

  6. Copy this downloaded file to %USERPROFILE%\.oci (or Home folder in Unix)

  7. Back in OCI click Add

  8. Don't touch anything in OCI yet, keep the window open

  9. Save the contents of the above to a new file called %USERPROFILE%\.oci\config (or Home folder in Unix) Note: the file does not have a file extension

  10. Change the last line to (change as necessary)


    My folder looks like this

Web Credentials

  1. In APEX, click Workspace Utilities > Web Credentials >Create

  2. Set the first 3 boxes like this

  3. Paste the contents of the PEM file you downloaded into the OCI Private Key

  4. Paste the values from the config file for OCI User ID, OCI Tenancy ID & OCI Public Key Fingerprint

  5. Click Create


  1. Create / Edit an APEX applicaton

  2. Create a Dynamic Content Region called Result from OCI

  3. Paste the following, changing the l_region_name if appropriate.

         l_region_name           CONSTANT VARCHAR2(32767) DEFAULT 'eu-frankfurt-1'; 
         l_credential_static_id  CONSTANT VARCHAR2(32767) DEFAULT 'oci';
         l_response CLOB; 
         -- Make the REST request
         l_response := APEX_WEB_SERVICE.make_rest_request(
             p_url          => apex_string.format( '',
                                                   l_region_name  ),
             p_http_method  => 'GET',
             p_wallet_path  => NULL,  -- Use this if you're using a wallet
             p_wallet_pwd   => NULL,  -- Use this if you're using a wallet
             p_credential_static_id  => l_credential_static_id 
         RETURN l_response;

  4. Run the page


If your OCI credentials worked, you'll see this.

If your OCI credentials do not work, you'll see this.


What's the picture? A brief stop whilst Mountain Biking right here.