Page 1 of 2
REST GET Request - Pass Variable in URL Issues
Posted: Mon Dec 16, 2013 3:41 pm
by Michael Iglesias
Hello,
I am trying to create a REST Service that is to fetch a list of items from an API I am developing.
I am attempting to make a GET Request to the following URL passing along an ID
http://162.243.56.184/api/index.php/p...
Example
http://162.243.56.184/api/index.php/p...
For some reason when I try and test the call so I can "Automatically Create Service Response" I receive a '404 Error Code'
The response I receive is as follows...
{
"status":"404 Not Found",
"url":"http://162.243.56.184/api/index.php/p...",
"response": ............
}
My question is why the variable ID is not being appended to the end of the url as I am trying to make a GET request.
REST GET Request - Pass Variable in URL Issues
Posted: Mon Dec 16, 2013 3:43 pm
by Michael Iglesias
Also, I did take a look at the following URL which did explain things to me a bit further but I still haven't figured out how to pass my ID Variable in the URL from a local storage variable.
http://docs.appery.io/documentation/r...
REST GET Request - Pass Variable in URL Issues
Posted: Mon Dec 16, 2013 4:02 pm
by maxkatz
Any parameters in the URL needs to be inside {...}, for example: {ID}.
Then you need to define a parameter with the same name in request and then map it from local storage.
The link that you reference shows an example.
REST GET Request - Pass Variable in URL Issues
Posted: Mon Dec 16, 2013 4:18 pm
by Michael Iglesias
REST GET Request - Pass Variable in URL Issues
Posted: Mon Dec 16, 2013 4:18 pm
by Michael Iglesias
REST GET Request - Pass Variable in URL Issues
Posted: Mon Dec 16, 2013 4:19 pm
by Michael Iglesias
REST GET Request - Pass Variable in URL Issues
Posted: Mon Dec 16, 2013 4:19 pm
by Michael Iglesias
REST GET Request - Pass Variable in URL Issues
Posted: Mon Dec 16, 2013 4:19 pm
by Michael Iglesias
REST GET Request - Pass Variable in URL Issues
Posted: Mon Dec 16, 2013 4:20 pm
by Michael Iglesias
It seems to work fine when I test the service and manually supply a "tnt_id"
For some reason it does not work when I am mapping a local storage variable to "tnt_id" when invoking the service on button click.
I believe I have everything set up correctly.
Any suggestions?
REST GET Request - Pass Variable in URL Issues
Posted: Mon Dec 16, 2013 4:21 pm
by maxkatz
Check and make sure the local storage variable is actually set.
In mapping, you can also try this. Open Edit JS and enter:
return 1;
to see if that works.