ssquire
Posts: 0
Joined: Tue Feb 12, 2013 4:36 am

Trouble getting Update Rest Service to work

Thanks Katya! That worked. I'm still missing something though. I still don't see the updated value in the Game Date label when I navigate back to the Game Notes page. Is this because I need to 1st execute a Curl command, in my Javascript, to Update the respective field in my database? (being that the Game Date label is linked to the Game Date field in my database - and that will be loaded when the page is loaded).

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Trouble getting Update Rest Service to work

Hi Steven,

When you return to another page using Back button or such a mechanism then only Page Show event is triggered. You should call your service on this event.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Trouble getting Update Rest Service to work

Hello! Sorry for delay. I'll update.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Trouble getting Update Rest Service to work

You can't put curl command in JS. codecurl -X PUT \ .........../code is a standard record to show what data and where you need to send. In your case (when you're going to update DB) you should call service and transmit data codeserviceName.execute({"data": {"param1": "param1value", "param2": "param2Value"}});/code

ssquire
Posts: 0
Joined: Tue Feb 12, 2013 4:36 am

Trouble getting Update Rest Service to work

I really hate to appear so ignorant on this, but I am confused. If I create an Update Service with no mapped parameters how will the database know what fields to update? How do I fill in the parameters of the service in order to make the code sample you supplied work?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Trouble getting Update Rest Service to work

You can pass all parameters in object "data" which you transmit in service call as shown here codeserviceName.execute({"data": {"param1": "param1value", "param2": "param2Value"}});/code
where param1, param2 - request parameters (you can add as many parameters as you need - all fields you're going to update, DB id, session token).

ssquire
Posts: 0
Joined: Tue Feb 12, 2013 4:36 am

Trouble getting Update Rest Service to work

I have implemented your code snippet and my javascript seems to be failing on service execution. Can you take a look and see if there is anything that jumps out at you. I have shared the project with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a. In particular it is when the 'ok' button is pressed on the "editDateandNotes" popup.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Trouble getting Update Rest Service to work

Hello! Are there any errors in console when you click 'ok'?

ssquire
Posts: 0
Joined: Tue Feb 12, 2013 4:36 am

Trouble getting Update Rest Service to work

Yes. When it attempts to call the service the following error message appears:

Uncaught TypeError: Object [object Object] has no method 'execute' startScreen.js:996
$.die.live.click startScreen.js:996
jQuery.event.dispatch jquery-1.8.2.js:3063
elemData.handle.eventHandle

Does this mean I can't call the REST service using the '.execute' method?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Trouble getting Update Rest Service to work

You have to use not service name, but datasource name in code.

Return to “Issues”