Michael Iglesias
Posts: 0
Joined: Tue Jul 23, 2013 8:51 pm

REST GET Request - Pass Variable in URL Issues

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.

Michael Iglesias
Posts: 0
Joined: Tue Jul 23, 2013 8:51 pm

REST GET Request - Pass Variable in URL Issues

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...

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

REST GET Request - Pass Variable in URL Issues

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.

Michael Iglesias
Posts: 0
Joined: Tue Jul 23, 2013 8:51 pm

REST GET Request - Pass Variable in URL Issues

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?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

REST GET Request - Pass Variable in URL Issues

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.

Return to “Issues”