Execute rest service on another page
Hi,
Is it possible to execute a rest service that is located on page 2 of my app from page 1 of my app.
Regards,
Joe
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Hi,
Is it possible to execute a rest service that is located on page 2 of my app from page 1 of my app.
Regards,
Joe
The service you want to execute has to be on the page.
Hi Max, Thanks for the reply, I have managed to implement this! But not for every service I am using a push notification handler to have the app re-query the Tiggzi database and update the data on the app.
var A = data.aps.alert;
if (A.indexOf("SERVICE1") = 0){
toast('Jobs Updated');
restservice1.execute({});
return;
}
else if (A.indexOf("LOCATIONUPDATE") = 0){
getPosition();
return;
}
else if (A.indexOf("Message") = 0){
playBeep();
alert (data.aps.alert);
Tiggzi("messagelabel").text(data.aps.alert);
return;
}
Because I want to alert the user to some events and not to others I have turned off the push alert, sound and badge, this works really nicely but it would be even better if I could add the notification message to the ones I wish to show! Don't suppose this is possible.
Regards,
Joe
A service instance has to be present on a page, in order to be invoked. You could invoke it from JavaScript.
Sorry Max, thought that was what I had asked!
Joe.. I put all my rest services on page 1 (main page). They are always available that way even on a multi-page template.
I use localstorage to send parameters and respond to results from the service..
My calls to the service are within an array like so..
code
var type=new Array("Service1.execute({});","Task ID","INSERT INTO 'test' SET ","'item1'","'item2'","'item3'");
/code
Store it. retrieve, parse and use eval to execute..
If your not passing data just use..
var myservice = "Service1.execute({});"//yourservice name here
Now to run the service use eval(myservice)
Or direct eval(Service1.execute({}););
Hope this helps
Its really useful to have your input I have followed your posts on tiggzi and have found them very valuable thanks.
Just hate to see folks struggle with the same stuff i did months ago..
Your welcome. And Thank you...
ps. I'll send off php code within the hour.
Hi Neil,
Thanks for the PHP, I have most of the processes you have In PHP in .net the one element I’m missing is how you are able to grab the GCM Key for the device. Do you do this with javascript compiled in Tiggzi or do you export your project into eclipse and build the method there. Any example you have on how you are doing this or advise you can give is much appreciated.
Regards,
Joe