In a previous episode, I showed how quickly you can REST enable your Oracle Database tables and views.
And I took a second or 3 to show how to create a module in SQL Developer’s REST Development panel, which allows you to have a RESTful endpoint served by a SQL statement which will bring your data back as JSON.
Today I want to take another 30 seconds to show how to add a :BIND to your query, and how to make that work with your RESTful service.
This example isn’t the best, as I could just REST enable the table, and use the built-in support for FilterObjects, e.g.
But, I want to show :BIND stuff, so let’s go there.
The important thing is not overthink this, like I was initially. You simply need to know what your :BIND is going to be in the query when you to define your URI for your service.
When you go to define your Template under your Module, you have to define your URI pattern.
And then when you go to define your query, you use that pattern to help write your query. You can always go back to the Template and change up the URI to match your query bind parameter name. I had forgotten that step and was getting 404 pages.
And that’s it. Nothing else to define really. Just upload your module, and make the call.
I think I’ll go into more detail and show some examples with the FilterObject Grammar stuff next, this stuff is whiz-bang cool, and really speaks volumes, at least to me, why this REST stuff is taking over the InnerWebs.
I used this with ords 184.108.40.206.18.02 and sqld 220.127.116.11.59, and it only worked for me to have the uri pattern as example/:binding.
It gave 404’s on the curly brackets. Is this a bug?
You specified both https and http in the query, the json object seems to not a valid one as well:
Could be something like: