Skip to main content

A Custom RESTful Service

These guidelines covers requirements for a custom RESTful templates enabling Rich Text Editor Pro to upload, display, browse and delete images.

The plug-in is shipped with the sample RESTful service showcasing uploading images within the sample application. It is a great start to explore the plug-in features, but it's not recommended to use it in production enviroment. It's stronly recommended to create your APEX application specific RESTful service implementing templates handling images.

sample restful service

The sample RESTful service is described here.

Rich Text Editor Pro page item is integrated with RESTful service responses, a custom service must implement templates based on specification in this document.

A custom RESTful service must implement the following template handlers:

ready to test

All code examples can be copied and pasted in Oracle APEX SQL Wokrshop \ RESTful services for fast and easy testing.

Handler parameters

The RESFTful service handlers utilizes PL/SQL bind variables to reference handler registered parameters, ORDS specific parameters and query parameters. These bind variables can be used to create custom logic within upload handler. For example, images can be saved in the database in the context of a currently edited document using the plug-in or displaying an image can be secured using a checksum.

All examples in this guidelines for a custom RESTful service uses REST specific paramters:

  • :body to reference uploaded image content
  • content_type to reference uploaded image MIME-TYPE
  • :status_code to set HTTP status code

Registered parameters

Definining ORDS RESTful service template handler includes specyfing what incoming or outcoming parameters are available in the PL/SQL code using PL/SQL bind variables. Registering these parameters is not required as long the handler PL/SQL code uses REST specific parameters.

REST specific parameters

Oracle REST Data Services (ORDS) adds these parameters automatically to the resource handlers. Learn more in the officiale Oracle documentation.

Query parameters

The query parameters don't have to be registered as handler parameters and they are available in the POST handler PL/SQL code using bind variables. The plug-in uses default query parameters for every image REST request. Query parameters can be extended on page load using the plug-in page item attribute Initialization JavaScript Code and image query parameter options or using the supporting dynamic action plug-in.