Page 1 of 1

How to filter a rest service response

Posted: Sat Jun 06, 2015 8:50 pm
by sdanigo

Hi,
I'm new with Appery.

I've setup rest services with API express taht are connected on a mySql database.

in my app, I've copy and past the URL and all works fine.

My URL looks like that:
https://appery.io/apiexpress-api/rest...

As my where is set to {} all records are returned.

I would like to filter these records on an ID.

I have a variable in my local storage (locID) and I've tryed to map it with the service but that doesn't seem to work.

Can someone put me on the track ?

Thanks

Sylvain


How to filter a rest service response

Posted: Sat Jun 06, 2015 10:26 pm
by EJLD

hi Sylvain, if I understand well you question
LS is named 'locID'
field is 'ID'

try what follows in where's js:

var locID = localStorage.getItem("locID");
return '{"ID":"'+locID+'"}';

Eric


How to filter a rest service response

Posted: Sat Jun 06, 2015 10:40 pm
by sdanigo

Hi Eric,
thanks for your response.

Where do I have to put that JS code ?
in the mapping ?

Thanks

Sylvain


How to filter a rest service response

Posted: Sun Jun 07, 2015 1:39 am
by EJLD

yes, in the mapping
before send
right hand top, under query
in where, just copy/past the above
it shld do the job


How to filter a rest service response

Posted: Sun Jun 07, 2015 10:44 pm
by sdanigo

Thanks a lot.


How to filter a rest service response

Posted: Mon Jun 08, 2015 3:48 am
by EJLD

avec plaisir


How to filter a rest service response

Posted: Mon Jun 08, 2015 3:49 am
by EJLD

avec plaisir