Yes, it’s another 10 Things list. I’ll stop writing these when you stop reading them. Deal? OK, no need for filler, let’s get right to the list!
Oh one disclaimer, there’s no particular order in this list, other than what popped into my brain.
1. All you need is an Oracle DB (11gR2 & higher) & ORDS
I’m often asked ‘what if I’m not in Cloud?’ or “what if we don’t have 19c?” The only things you need are a supported version of Oracle Database, and Oracle REST Data Services (ORDS).
2. You can write no code, use our code, or write your own!
Implementing the logic behind a REST API for a database falls down to a couple of things..
- the SQL or PL/SQL the database will be running
- taking in the inputs and transforming outputs to JSON (or CSV or XML or…)
- generating link(s)
- attaching HTTP response code
- implementing security
- paging contents of your larger collections
ORDS can and will do ALL of this for you. If you want to simply call one of your existing PL/SQL procedures, you can ‘enable’ it, and then immediately access it via a HTTPS POST request.
Or, you could write a small stub of a PL/SQL anonymous block to call your program.
Or, you could write ALL the code to construct the HTML/JSON response for your API.
3. Design your APIs with Swagger, then import to the DB!
Yes, you can design your templates, handlers, etc in popular design tools like Swagger, and then take those definitions and import them directly into Oracle, and we’ll set them up for you in the database.
After that, it’s only up to to implement the code behind the handlers (we’ll provide some hello world stubs), and the security privs.
4. The APIs can be for the database, itself!
In fact, we ship DOZENS of APIs for managing and monitoring the database, all you need to do is enable them!
Check out some of these beauties!
5. Customer are implementing critical features via REST
I’ve talked to customers all over the world, and they’re using REST APIs on their Oracle Database to do ALL of these things –
I think they’re all cool use cases, but one customer we’re working with now is going to use a REST API to process sales of their most popular product, to the tune of 500-600 requests per second!
Another cool use case is this public story for an IOT implementation that allows the company to track exactly what’s happening in the field, to the tune of more than 600,000 events a month.
In our Autonomous Database Cloud regions, we’re handling more than 1 billion HTTPS requests a week for our customers and their applications!
6. You can make a REST Call before there’s even a database
You can hook ORDS up to your $ORACLE_HOME and have a call to kick off a Database Creation Assistant (DBCA) job to CREATE A BRAND NEW INSTANCE, or you could use our Multitenant support to create or clone a new pluggable database.
7. Generating LINKs is easy and NECESSARY for REST!
Do you even Hypermedia as the engine of application state (HATEOAS) ? As you are presenting your resources in your REST API responses, the LINKs you share back allow your API consumers to decide what their ‘next action’ or task will be.
Generating those links is pretty easy, regardless if your Handler source if SQL or PL/SQL. I’ll show you examples for both of those scenarios here.
9. It’s easy to get started, writing your first REST API
We give you lots of resources, some I highly recommend:
- Oracle LiveLabs – borrow our sandbox, follow the directions, point-and-click tutorials
- ORDS Container
docker pull container-registry.oracle.com/database/ords:latest - VirtualBox Appliance – it has a database and ORDS all ready to go!
- YUM or Homebrew (brew install ords)
- Oracle Cloud Always Free Autonomous, watch Layla’s video demo, step by step
10. It’s fun, I promise!
Once you start ‘playing’ with your data, you’ll quickly find there’s lots of interesting ways it can be used, once you make it available via REST APIs.
Need some inspiration? I have an examples here using my personal workout, or exercise data (Strava!) I have other examples on that page using Netflix, Untappd, Spotify, and more…
Searching all my rowing workouts by looking for the rowing man emoji in my activity descriptions…
GET ords/admin/strava/activities/?q={"description":{"$instr":"🚣"}}
11. Bonus Content: prefer GraphQL? We do that, too!
Getting started with GraphQL queries on your Oracle Database.