Oracle APEX on ATP: Real-World Integration with OCI Services

 

๐Ÿงญ Introduction

Oracle APEX on Autonomous Transaction Processing (ATP) is a powerful low-code platform that enables rapid application development, directly on Oracle Cloud. But its real strength is unlocked when integrated with other OCI services such as Object Storage, Functions, Monitoring, and Email Delivery.

In this blog, we’ll walk through real-world use cases and demonstrate how APEX applications can seamlessly connect, consume, and extend OCI services to build modern cloud-native solutions.


๐Ÿงฉ Why Integrate APEX with OCI Services?

FeatureBenefit
๐Ÿง  Native cloud access       Direct interaction with OCI APIs from APEX
⚙️ Serverless computeExtend APEX logic using Oracle Functions
๐Ÿ“ฆ Object StorageStore & retrieve documents, images, reports
๐Ÿ“ˆ Monitoring & AlertsApp-level observability & automation
✉️ Email DeliverySend user notifications or alerts

๐Ÿ”ง Prerequisites

  1. ATP instance with APEX enabled

  2. Access to OCI tenancy with appropriate permissions

  3. Authenticated access using OCI REST APIs

    • Auth via Resource Principal (preferred on ATP)

    • Or using API signing keys (if external access is needed)





๐Ÿงช Use Case 1: Upload & Access Files in OCI Object Storage

๐Ÿ”น Step 1: Create a Bucket in OCI


oci os bucket create --name apex-bucket --compartment-id <compartment_ocid>

๐Ÿ”น Step 2: Use PL/SQL to Upload Files

Create a PL/SQL Web Source Module in APEX using OCI Object Storage REST API:


declare

  l_blob BLOB := :P1_FILE;

  l_resp CLOB;

begin

  apex_web_service.g_request_headers(1).name := 'Authorization';

  apex_web_service.g_request_headers(1).value := 'Bearer ' || get_auth_token();


  l_resp := apex_web_service.make_rest_request(

    p_url => 'https://objectstorage.<region>.oraclecloud.com/n/<namespace>/b/apex-bucket/o/myfile.jpg',

    p_http_method => 'PUT',

    p_body_blob => l_blob,

    p_wallet_path => 'file:/wallet',

    p_content_type => 'image/jpeg'

  );


  :P1_RESPONSE := l_resp;

end;

๐Ÿ“Œ Use DBMS_CLOUD or DBMS_CREDENTIAL for secure credential handling.




๐Ÿ”ƒ Use Case 2: Triggering Oracle Functions from APEX

๐Ÿ”น Step 1: Deploy a Function

Use Fn Project or OCI Console:


fn init --runtime python apex-notifier
fn deploy --app apex-utils

๐Ÿ”น Step 2: Call Function via REST from APEX

Use APEX_WEB_SERVICE.MAKE_REST_REQUEST:

declare
  l_response clob;
begin
  l_response := apex_web_service.make_rest_request(
    p_url => 'https://<invoke-url>',
    p_http_method => 'POST',
    p_body => '{ "user_id": ' || :P1_USER_ID || ' }',
    p_content_type => 'application/json'
  );
  :P1_OUTPUT := l_response;
end;

✅ Example Use Cases:

  • Sending SMS/Email via function

  • Backend image processing

  • Serverless workflow triggers

๐Ÿ“ก Use Case 3: Monitoring APEX App Events via OCI Monitoring

๐Ÿ”น Step 1: Enable Custom Metrics in Your PL/SQL

Push custom metrics from APEX:

declare

  l_response clob;

begin

  l_response := apex_web_service.make_rest_request(

    p_url => 'https://telemetry-ingestion.<region>.oraclecloud.com/20180401/metrics',

    p_http_method => 'POST',

    p_body => '{

      "namespace": "apex_metrics",

      "compartmentId": "<compartment_ocid>",

      "name": "UserLogins",

      "dimensions": {

         "app": "HelpDesk"

      },

      "datapoints": [

         {

            "timestamp": "' || to_char(systimestamp, 'YYYY-MM-DD"T"HH24:MI:SS.FF3"Z"') || '",

            "value": 1

         }

      ]

    }',

    p_content_type => 'application/json'

  );

end;

๐Ÿ“Š Then build alarms in OCI Monitoring Dashboard for:

  • Login spikes

  • Failed transactions

  • Custom thresholds

๐Ÿ“ง Use Case 4: Send Emails via OCI Email Delivery

๐Ÿ”น Step 1: Set Up Email Delivery in OCI

  • Create approved sender email

  • Generate SMTP credentials

๐Ÿ”น Step 2: Use APEX_MAIL with SMTP

begin
  apex_mail.send(
    p_to => 'user@example.com',
    p_from => 'no-reply@yourdomain.com',
    p_subj => 'Welcome to Our App',
    p_body => 'Hello, your account has been activated!'
  );
  apex_mail.push_queue;
end;
๐Ÿ“Œ Configure SMTP settings in APEX instance setup.

๐Ÿ” Authentication: Resource Principals (ATP-Only)

If using ATP, you can use resource principal authentication with DBMS_CLOUD.SEND_REQUEST.

BEGIN

  DBMS_CLOUD.SEND_REQUEST(

    credential_name => 'OCI_RESOURCE_PRINCIPAL',

    uri => 'https://objectstorage.<region>.oraclecloud.com/n/...'

  );

END;

✅ Recommended for secure, managed integration directly from ATP without API keys.


๐Ÿ’ก Bonus: Use Oracle AI Services

Combine APEX forms with:

  • OCI Vision (image classification)

  • OCI Speech (transcription)

  • OCI Language (text sentiment, NER)

Invoke via REST API using pre-authenticated headers from within PL/SQL.

๐Ÿ“Œ Summary

OCI Service            APEX Use Case
Object Storage                          File upload/download
FunctionsBusiness logic extension
MonitoringCustom metrics & alerts
Email DeliveryNotifications & password resets
AI ServicesIntelligent app features

๐Ÿงญ Final Thoughts

Oracle APEX + ATP + OCI = a low-code cloud-native development powerhouse. With just PL/SQL and a few clicks, you can tap into enterprise-grade services and build modern, secure, and intelligent apps without needing to manage infrastructure or deploy code.

๐Ÿ“Ž Resources







Comments

Popular posts from this blog

Introduction to Oracle Vector Search – Concepts, Requirements & Use Cases

Setting Up Monitoring and Alerts in OCI for Your Resources