Oracle Autonomous Database is a Platform as a Service (PaaS) offering on the Oracle Cloud (OCI). It’s managed, meaning you don’t have to worry about updates, patches, or much in way of configuration.

One of the core features is the ability to publish and consume REST APIs for the data in your Autonomous Database – whether that be on the Dedicated, Serverless, or Always Free service offerings.

I wanted to answer a few frequently asked questions and share a couple of useful resources for you in this post.

How are my endpoints addressed?

Not all HTTP is REST, but all REST APIs use HTTP for communication. And a HTTP call generally has two main components, an address and a verb.

Well, if you publish a REST API in Autonomous, what the heck is my URL? We show you this critical information in your Service Console.

Click here.

From there, you want to go look in the ‘Development’ page.

This will form the base of every URL you use for the REST APIs in your service.

So what comes after the /ords/ ?

Your REST APIs will look like this –

  • /schema/module/service-pattern
  • /schema/rest-enabled-object

The schema is the REST Enabled schema name, or it’s schema alias, which we refer to as the url_mapping_pattern.

What else do I need to know about ORDS in Autonomous?

OS Authentication is available if you want it. But note that means consumers of your API will be logging in as actual Oracle Database users, and you’ll be using BASIC Auth, which is generally frowned upon, even when HTTPS is in play.

We recommend you use an ORDS provided OAUTH2 client. Hot Tip #1 – use Todd’s awesome blog post to see how to do this.

Speaking of database users – for Autonomous your default administrator account is called ‘admin,’ and it’s REST Enabled by default. That means the admin user can login to SQL Developer Web AND publish REST APIs in its schema.

WE DO NOT RECOMMEND YOU USE ADMIN FOR PUBLISHING REST APIs.

WE DO RECOMMEND YOU CREATE AN APPLICATION SCHEMA AND USE THAT.

Building Services – with what tools?

You can use anything that can connect to your database and exercise the ORDS PL/SQL APIs. We recommend you either use SQL Developer on your desktop or the REST Development screens in APEX. Note, you don’t have to build APEX apps to take advantage of the REST development screens. Further note, we’ll be building similar pages in SQL Developer Web very soon.

SQL Developer or APEX – easier than hand-writing PL/SQL blocks, but that will work too!

Just give me a movie to watch, TL;DR

I have a 12 minute video demonstration showing a REST service in Autonmous that you can watch here.

Fairly short…and I’ve skipped all the blah blah blah and go STRAIGHT to the demo!

Can’t do YouTube at work? Here are some slides.

thatjeffsmith
Author

I'm a Master Product Manager at Oracle for Oracle SQL Developer. My mission is to help you and your company be more efficient with our database tools.

4 Comments

  1. Raul Castro Reply

    Hi Jeff, I am trying to install ORDS on a Compute Instance on OCI, I am following the documentation:
    https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/19.4/aelig/installing-and-configuring-customer-managed-ords-autonomous-database.html#GUID-D90EFD26-AC36-4907-BF95-3E05E82BC3E0

    I have tested connection from sqlcli to the autonomous database an is succesfull….

    I’m kidda stuck on the part where the ords installation asks me for the administrator username:

    —————————————————————————————————–
    Enter the location to store configuration data: config
    Specify the database connection type to use.
    Enter number for [1] Basic [2] TNS [3] Custom URL [1]:2
    Enter the TNS Network Alias:grupokatp_low
    Enter 1 if you want to verify/install Oracle REST Data Services schema or 2 to skip this step [1]:
    Enter the database password for ORDS_PUBLIC_USER:
    Confirm password:
    Requires to login with administrator privileges to verify Oracle REST Data Services schema.

    Enter the administrator username:admin
    Enter the database password for admin:
    Confirm password:
    Connecting to database user: admin url: jdbc:oracle:thin:@grupokatp_low

    Retrieving information.
    java.sql.SQLSyntaxErrorException: ORA-01031: insufficient privileges
    ORA-06512: at line 81
    —————————————————————————————————

    Can you lead the way please

    Thanks

    • thatjeffsmith

      You won’t actually do AN install or ORDS against autonomous – because ORDS is already installed there. Also, ORDS_PUBLIC_USER is already there, and you CANNOT have/know it’s password.

      You’re just going to stand up the local ORDS config files, and have a pool configured to use your own ORDS_PUBLIC_USER account, aka ORDS_PUBLIC_USER2, to create your JDBC Connection pool to Autonomous.

      Here’s a great blog post on the subject that goes into pretty good detail
      https://fuzziebrain.com/content/id/2004/

  2. Hi,

    When I am trying to use some nested json response, with a SELECT like:

    select col1, col2
    cursor(select col3, col4
    from t2 where t2.col1 = t1.col1
    ) as ArtInfo
    from t1

    It does not return anything, but if I run the select statement standalone, it returns data.
    Do you know why when I put this select statement in p_source from ords.define_service, it does not return anything? It’s like it is trying to retrieve data, without end … 2 minutes passed and nothing.
    I want col3 and col4 to be displayed as a nested item of col1 and col2 (which are kind o “header” data)

    Thanks!

    • Raul Castro

      Thanks Jeff!

      The Post you refered worked!

      Thanks!!! An Cheers!

Write A Comment