6.4 How to Enable REST Objects from the Object Browser

Access Object Browser from the Workspace home page by clicking SQL Workshop and then Object Browser.

6.4.1 About Enabling REST Objects from the Object Browser

Learn about Enabling REST Objects from the Object Browser.

Oracle Application Express 19.1 installations that utilize Oracle REST Data Services (ORDS) 17.4 or later support the ability to REST enable database objects using the AutoREST feature of ORDS. You can use AutoREST to REST enable tables, views, packages, procedures, and functions. Although AutoREST is the quickest way to expose database objects through REST, this feature has some drawbacks when it comes to flexibility and customizability. AutoRest lets you quickly expose data but (metaphorically) keeps you on a set of guide rails. For example, you cannot customize the output formats or the input formats, or do extra validation.

See Also:

"Automatic Enabling of Schema Objects for REST Access (AutoREST)" in Oracle REST Data Services Installation, Configuration, and Development Guide

6.4.2 Enabling REST Objects from the Object Browser

A new REST tab appears in Object Browser when selecting a TABLE, VIEW, PACKAGE, PROCEDURE, or FUNCTION. The tab exposes a form that provides the ability to REST Enable a database object using ORDS.

To enable REST Objects from the Object Browser:

  1. On the Workspace home page, click SQL Workshop and then Object Browser.
  2. From the list of object types, select Table.
  3. Click REST tab.

    Note:

    If the schema has not been registered with ORDS RESTful Data Services. A message is displayed to register the schema.

  4. On the Workspace home page, click SQL Workshop.
  5. Click RESTful Services.

    The RESTful Services home page appears.

  6. Click Register Schema with ORDS.

    ORDS Schema Attributes dialog appears.

    1. In the attribute details, enter the name of the schema alias to be used in the formation of the URL referencing any RESTful service within the schema and leave all other options at default values.
  7. Click Save Schema Attributes.

    ORDS RESTful page appears with a message Schema enabled for use with ORDS RESTful Services and sample RESTful Service successfully installed.

  8. On the Workspace home page, click SQL Workshop and then Object Browser.
  9. From the list of object types, select Table.

    The Table details is displayed with ORDS Version and the form to AutoREST enable the object is displayed.

  10. Enter the attribute details:
    1. REST Enable Object - Click Yes.
    2. Object Alias – Default value.
    3. Authorization Required – Click No.
    4. Authorization Role - Name of the auto-created ORDS role (if Authorization Required is set to YES)
    5. RESTful URI - This provides the case sensitive URI that is used to access the REST enabled object.
  11. Click Apply.

    A success message is appears and a new RESTful URI field appears on the form.

    RESTful URI - This provides the case sensitive URI that is used to access the REST enabled object.

  12. Click the Copy to Clipboard button located to the right corner of RESTful URI.
  13. Open a new browser tab and paste the copied URI into URL region and press Enter.

    The browser displays a JSON document exposing the table data for the table you selected.

    Note:

    Once the object has been REST Enabled, you can access the data through the supplied URI.

  14. On the Workspace home page, click SQL Workshop.
  15. Select the REST tab of the REST enabled object.
  16. Click Yes for Authorization Required.
  17. Click Apply.
  18. A new Authorization Role field appears showing the ORDS created role associated with the AutoREST Enabled object.

    Note:

    Trying to access the RESTful URI for the object should now respond with a 401 - Unauthorizederror message.