Monday 13 November 2023

Create an APEX Interactive Grid on an ORDS AutoREST service

 If the target database cannot be accessed by a database link, this might be a super easy alternative.

Say you have an HR schema with the EMPLOYEES table. RMB and choose Enable REST Service ...

For this easy example, check Enable object and uncheck Authorization required. Click through the dialog until the end.
Open Database Actions and go to REST > AutoREST to find the EMPLOYEES Service. Click on the Open in new tab icon right of the URL.
That should work ootb, copy the URL
Move over to the APEX App Builder, Shared Components, REST Data Sources and click on Create.
Choose from scratch, give it a name, paste the service URL and change REST Data Source Type to Oracle REST Data Services. Click through the end of the dialog, accepting the defaults.
In your application, create a new page with an Interactive Grid. Point it to the new REST Data Source and check Editing Enabled, if you want to use that.
For editing, it is mandatory to select a primary key column. Click through the end of that dialog.
Run the page, change some data and click Save.
That should work without any extra manual configuration or coding.