Hawk
Hawk

Reputation: 5170

Using RESTFul Oracle APEX

I am building a mobile App using Appery.io platform which uses MongoDB -based database. I need to link this DB to Oracle database and use APEX to design an interface such that users can query, update the mobile App DB from Oracle as well as Oracle DB can be updated from the mobile App.

In APEX, I use the URI with GET method:

https://api.appery.io/rest/1/db/collections/Outlet_Details/

And I add the header:

X-Appery-Database-Id

When I run the query in the APEX where I insert the Database-Id, APEX shows the table/collection Outlet_Details in JSON format. However, not the entire table is shown due to, I think, the length of CLOB type.

Now my main problem is I need to query this table/collection called Outlet_Details by a column named: _id. So when I use the following URI:

https://api.appery.io/rest/1/db/collections/Outlet_Details/1234

It returns the specific record that ha _id = 1234. However, I do not want to hardcode it. Instead, I need to have more like where condition such that I can query based on any column value (e.g. userId instead _id). The CURL command is as follows:

curl -X GET
-H "X-Appery-Database-Id: 544a5cdfe4b03d005b6233b9"
-G --data-urlencode 'where={"userId ": "1234"}'
https://api.appery.io/rest/1/db/collections/outlet_details/

My problem is how to insert such a command into APEX, specailly (where) part.

In this tutorial, oracle database is used. Hence using where condition with =:DEP condition, and then bind it to a variable is pretty straightforward. However, I need to replicate this tutorial with my MongoDB. The other question, which I guess would clarify a lot to me, in the aforementioned tutorial, there is a prefix URI that is by default APEX shema URI. Even when I insert different URI template, the resultant URI will append APEX to the one I inserted. How to build a service there using different URI?

Upvotes: 0

Views: 926

Answers (1)

Hawk
Hawk

Reputation: 5170

I found that APEX takes where condition as encoded parameter in the URL. Something like:

https://api.appery.io/rest/1/db/collections/Outlet_Details?where=%7B%22Oracle_Flag%22%3A%22Y%22%7D

The header is same and no input parameters.

This can be done from Application builder > New Application > Database > Create Application > Shared Componenets > Create > REST and then start inserting the header, utl .. etc.

You can refer to this link as a reference encoded URL

Upvotes: 0

Related Questions