sdanigo
Posts: 0
Joined: Sat Jun 06, 2015 8:50 pm

How to filter a rest service response

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

EJLD
Posts: 0
Joined: Sun Jun 08, 2014 11:03 pm

How to filter a rest service response

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

sdanigo
Posts: 0
Joined: Sat Jun 06, 2015 8:50 pm

How to filter a rest service response

Hi Eric,
thanks for your response.

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

Thanks

Sylvain

EJLD
Posts: 0
Joined: Sun Jun 08, 2014 11:03 pm

How to filter a rest service response

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

sdanigo
Posts: 0
Joined: Sat Jun 06, 2015 8:50 pm

How to filter a rest service response

Thanks a lot.

EJLD
Posts: 0
Joined: Sun Jun 08, 2014 11:03 pm

How to filter a rest service response

avec plaisir

EJLD
Posts: 0
Joined: Sun Jun 08, 2014 11:03 pm

How to filter a rest service response

avec plaisir

Return to “Issues”