Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Query Appery.io using Oracle APEX

Hi,

I need to link Appery 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 build REST service, in which I use the URI with GET method:

prehttps://api.appery.io/rest/1/db/collections/Outlet_Details//pre

And I added the header:

preX-Appery-Database-Id/pre

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 data 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:

prehttps://api.appery.io/rest/1/db/collections/Outlet_Details/{_id}/pre

and add another header called _id

It does not return anything no matter what the _id value I insert. So my question, is the method I followed correct? If not, what is missing? and is there any reference to query and update Appery DB from different DB?

Thanks,

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Query Appery.io using Oracle APEX

Hello,

"and add another header called _id" - the header _id doesn't need, you should pass _id in the url as you wrote. Please read more here http://devcenter.appery.io/documentat...
I.e. the url will be, for example
prehttps://api.appery.io/rest/1/db/collections/outlet_details/54578046e4b0c9bce12bd075/pre
without any brackets around _id.
If you need to get a list of all the _id from the collection, please use Projection http://devcenter.appery.io/documentat...

Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Query Appery.io using Oracle APEX

Thanks Evgene, by using the url you posted I can get the specific record in APEX. However, I need it to be variable in where-like way. That is, I want to query the collection Outlet_Details by the column userId ( and not _id). So the CURL command is something like:

pre
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/
/pre

How can I convert it into URL (adding where condition to the url)?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Query Appery.io using Oracle APEX

Hi Hawk,

here is URL example:

pre

{database_url}/collections/outlet_details?where={"userId":"1234"}

/pre

Details: http://prntscr.com/57uwxy/direct

Regards.

Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Query Appery.io using Oracle APEX

Hi Yurri,

I tried this and it returns "HTTP status 400, The request sent by the client was syntactically incorrect".

When I use:
pre{database_url}/collections/outlet_details//pre
It returns the entire collection successfully,
When I use:
pre{database_url}/collections/outlet_details/54578046e4b0c9bce12bd075/pre
It returns the specific recor with _id = 54578046e4b0c9bce12bd075
But when I use :
pre{database_url}/collections/outlet_details?where={"UserId":"1234"}/pre
I get the error above

Thanks for helps

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Query Appery.io using Oracle APEX

Hawk,

Please show us returned by server error.

Regards.

Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Query Appery.io using Oracle APEX

Hi Yurii,

This is the response without where :

Image

And this when I use where:

Image

Thanks,

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Query Appery.io using Oracle APEX

Hello Hawk,

Please try using urlEncoded value in the url.
i.e. instead of
pre{"UserId":"1234"}/pre
please paste in the url
pre%7B%22UserId%22%3A%221234%22%7D/pre

Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Query Appery.io using Oracle APEX

Thanks Evgene, the urlEncoded value worked for me. But now the question, how to convert each query to urlEncoded? Is there any reference?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Query Appery.io using Oracle APEX

Hi Hawk,

Yes you can read about it here:

http://www.w3schools.com/tags/ref_url...

Regards.

Return to “Issues”