Overview

Object Storage unit is a high-performance storage platform. It is ideal for storing an unlimited amount of unstructured data. Data is managed as objects using an API built on standard HTTP verbs. Safely and securely store or retrieve data. A regional service and is not tied to any specific computing instance.

 

Technologies and Tools Used

The following technology has been used to achieve the expected output.

  • Oracle Apex Cloud

 

Use Case

When users move from oracle on-premise to oracle cloud, The Object Storage unit requires to set up the data storage. If you need fast, immediate, and frequent access to data you can use the Object Storage unit.

Using the Object Storage unit you can store and retrieve the data. For the attachment upload and download here we are going to use the Object Storage unit.

This document explains how to integrate the Object Storage unit into oracle apex.

Architecture

Create Web Credentials in Oracle Apex 

Use APEX web credentials to connect to REST services and securely store the credentials.

Before creating the web credentials in the APEX workspace, obtain the required information from the Oracle Cloud Infrastructure console:

  • OCI User ID
  •  Click the hamburger icon (≡), select Identity, and click Users.
  •  Find and click the Show link to expose the full Oracle Cloud Identifier (OCID) value.
  •  Click Copy.

  •  OCI Tenancy ID
  •  Click the hamburger icon (≡), select Administration, and click Tenancy Details.
  •  Find and click the Show link to expose the full OCID value.
  •  Click Copy.

  •  Copy the OCI Private Key from the poa_oci_api_key.pem file.

create the web credential:

  •  In the APEX application’s Shared Components, click Web Credentials (in the Security section).

  • Click Create.Fill in the required fields, using the information gathered earlier in this section.

  1. Name: OCI_AUTH
  2. Static Identifier: OCI_OBJECTSTORAGE_AUTH
  3. Authentication Type: Oracle Cloud Infrastructure (OCI)
  4.  OCI User ID: See above.
  5.  OCI Private Key: See above.
  6.  OCI Tenancy ID: See above.
  7. OCI Public Key Fingerprint: See above.
  • Click Create.

Create REST Data Source in Oracle Apex

In this section, you’ll create two web source modules:

  • list_buckets
  • list_objects_in_bucket

As the names imply, the first WSM will list the buckets within a specified compartment, such as PROD. The second will list the objects found in a named bucket, such as apex_file_storage.

The following additional information about your tenancy will be required:

  •  API endpoints – Depending on the region where the bucket is located, choose the endpoint from the list available here.
  •  Object storage namespace
  •  Click the hamburger icon (≡), select Administration, and click Tenancy Details.
  • The required namespace value is in the Object Storage Settings section.

  •  Compartment ID
  •  Click the hamburger icon (≡), select Identity, and click Compartments.
  • Copy the OCID value from the Compartments page.

Create the list_bucket WSM. Take the following steps:

  •  In the APEX application, go to Shared Components and click REST Data Sources .
  •  Click the Create > button.
  •  Select the From scratch option on the first wizard page, and click Next >.
  •  Provide the required information, and click Next >.

  •  Web Source Type: Oracle Cloud Infrastructure (OCI)
  •  Name: list_buckets
  •  URL Endpoint: Use the format
    https://objectstorage.<REGION>.oraclecloud.com/n/
    <NAMESPACE>/,
    and substitute the placeholders with the information obtained earlier in this section.
  • APEX will parse the endpoint and suggest what to enter for Base URL and Service URL Path. Because you will be working within a single tenancy, include the namespace information in Base URL.

  • Select Authentication Required and the appropriate choice for Credentials. Click Advanced >.

  • Create a Query String variable parameter. Enter the required information, and click Discover >.

  1. Parameter Type: Query String variable
  2. Parameter Name: compartmentId
  3. Value: Use the value you obtained earlier in this section.
  4. Is Static: Select Is Static.
  • WSM automatically discovers the REST service’s response and creates a data profile. Check that the information is correct, and click Create Web Source to complete the process.

Create the list_objects_in_bucket WSM.

IMPORTANT: Ensure that at least one file has been uploaded to the target bucket with the Oracle Cloud Infrastructure console. If the bucket is empty, the WSM data profile discovery phase will fail!

  • In the APEX application, go to Shared Components and click REST Data Sources.
  • Click Create >.
  • Select the From scratch option on the first wizard page, and click Next >.
  • Provide the required information, and click Next >.

  1. Web Source Type: Oracle Cloud Infrastructure (OCI)
  2. Name: list_objects_in_bucket
  3. URL Endpoint: Use the format
    https://objectstorage.<REGION>.oraclecloud.com/n/
    <NAMESPACE>/b/:bucket_name/o/,
    and substitute the placeholders with the information obtained earlier in this section.
  4. URL Parameter 1: bucket_name (This parameter was created automatically by APEX.)
  5. Value: apex_file_storage
  • APEX will parse the endpoint and suggest what to enter for Base URL and Service URL Path.

  • Select Authentication Required and the appropriate choice for Credentials. Click Advanced >.
  • The first parameter, Parameter Name = bucket_name, is created automatically by APEX. Leave the defaults. Create another parameter, provide the required information, and click Discover >.

  1.  Parameter Type: Query String variable
  2.  Parameter Name: fields
  3.  Value: name,size,timeCreated,md5
  4.  Is Static: Select Is Static.
  • Check that the information is correct, and click Create Web Source to complete the process.

Conclusion

In this document, we have seen how to integrate the Object storage unit in the oracle apex Cloud. In the next, we will see how to upload and download data using the Object storage unit.

How to Upload and Download Files using Object Storage Unit in Oracle Apex

Recommended Posts

Start typing and press Enter to search