Sample RESTful service
By the default, the plug-in uses sample ORDS RESTful service to upload, display, browse and delete uploaded images in the database. The RESTful service can be used to save uplaoded images in the database, filesystem or external file services.
Any modifications to the sample RESTful service might be overridden in the future when updating plug-in to the most recent version. Because of that, we strongly recommend implementing your own RESTful service, for example as a copy of sample service. In guidelines section, you will find specification for a custom RESTful service compatible with Rich Text Editor Pro page item.
The plug-in sample RESTful service is created when the plug-in sample application supporting objects are installed or when installing the plug-in using DDL script. The sample RESTful services is used by the plug-in default configuration and the plug-in sample application. Uploaded images are stored in the plug-in sample table UC_FROALA_SAMPLE_CLOB_BLOBS.
The sample RESTful service implements templates described in the table below.
Template | Method | Description |
---|---|---|
browse | GET | Template is used to browse previously uploaded images stored in the database. |
delete | POST | Template is used to delete images displayed in the Froala image browser. |
get/:fileid | GET | Template displays uploaded images embedded in CLOB content. |
upload | POST | Template handles image upload using. |
browseFolder | GET | An example implementation showing image filtering using custom parameter folder. |
uploadFolder | POST | An example implementation of uploading images with a custom parameter folder. |
Access token
The plug-in secures RESTful service request using the plug-in access token encoded using plug-in instance-specific salt string defined in the plug-in package UC_FROALA_SETTINGS. The encoded access token is available to all RESTful handlers through default query parameters. The access token is computed and encoded when Oracle APEX engine renders page item implementing the Rich Text Editor Pro.
When processing RESTful image request, a developer can decode the access token and get secured information about application session ID, given URL displaying uploaded images.
Using access token to secure RESTful service request is not mandatory but it's stricly recommended.
Salt string
The salt string is string definable in the plug-in package UC_FROALA_SETTINGS. The salt string is used to encode the access token and it should be changed after installing the plug-in.
Default query parameters
The plug-in RESTful service template handlers are invoked with additional default data send using query parameters. These query parameters can be used to identify application meta-data (session, id, page id, user) and uploaded image using PL/SQL bind variables.
Custom query parameters require extending sample RESTful handlers (we do not recommend it), or creating a custom RESTful service. A custom query parameters can be defined using the plug-in page item attribute Initialization JavaScript Code and image query parameter options (computed once on a page load) or using the supporting dynamic actions Upload Parameters and Image Browser Parameters.
By the default, the plug-in uses default query parameters described in the table below.
Parameter Name | Bind variable | Data type | Description | Upload | Browse | Delete |
---|---|---|---|---|---|---|
accessToken | :accessToken | VARCHAR2 | A current encoded access token. | ✔️ | ✔️ | ✔️ |
sessionId | :sessionId | VARCHAR2 | A current APEX session ID. | ✔️ | ✔️ | ✔️ |
applicationId | :applicationId | VARCHAR2 | A current application ID. | ✔️ | ✔️ | ✔️ |
pageId | :pageId | VARCHAR2 | A current application page ID | ✔️ | ✔️ | ✔️ |
appUser | :appUser | VARCHAR2 | A current application username. | ✔️ | ✔️ | ✔️ |
filename | :filename | VARCHAR2 | An image filename is available only when an image is dragged and dropped from the desktop. | ✔️ | ❌ | ❌ |
tempUniqueId | :tempUniqueId | VARCHAR2 | An image temporary ID assigned by the plug-in. | ✔️ | ❌ | ❌ |
imageId | :imageId | VARCHAR2 | An image ID in the database. | ❌ |