Terry Gilliver
Posts: 0
Joined: Fri Apr 18, 2014 8:45 pm

servicename.execute({}); full syntax

I have seen many samples of service.execute({});

I have never seen the complete syntax anywhere.

I have my own ideas, could you very that the following is correct

pre service_name.execute({

Code: Select all

 success: function( PlainObject data, String textStatus, jqXHR jqXHR ) { 
 //Success handler here 
 }, 

 error: function( jqXHR jqXHR, String textStatus, String errorThrown ) { 
 //Error handler here 
 }, 

 complete: function( jqXHR jqXHR, String textStatus ) { 
 //Complete handler here 
 }, 

 parameters: {object with 'query string' request parameters}, 
 data: { object with 'body' request params }, 
 headers: { object with request header params } 
 });/pre 

Is this correct?
Is it now outdated in preference to a newer method of executing services?

Jeffry Reed
Posts: 0
Joined: Sun Aug 14, 2016 3:59 pm

servicename.execute({}); full syntax

Hi Terry,

i could be wrong but I think its like this per documentation https://devcenter2.appery.io/document...

serviceInstanceName.execute({});

Passing parameters

serviceInstanceName.execute({
data:{},
headers:{}
});

Terry Gilliver
Posts: 0
Joined: Fri Apr 18, 2014 8:45 pm

servicename.execute({}); full syntax

i think you are correct in what you are saying, but I think that data:{} is where the parameters are passed in the body of the request . I seem to have read somewhere that query string parameters are passed as parameters:{}. I just wanted to verify this.

Also since this is missing from the new documentation, I wondered whether or not that this is now an outdated method for running a service from javascript

Terry Gilliver
Posts: 0
Joined: Fri Apr 18, 2014 8:45 pm

servicename.execute({}); full syntax

i think I have proved my point with the querystring parameters, the following snippet works perfectly:

Image

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

servicename.execute({}); full syntax

Hello Terry,

You are right. Please clarify, do you need further assistance there?

Terry Gilliver
Posts: 0
Joined: Fri Apr 18, 2014 8:45 pm

servicename.execute({}); full syntax

Just an update, I couldn't find any info in the new documentation, regarding this, Is there a new preferred way of doing it rather than service.execute()?

Otherewise, i am happy with your response.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

servicename.execute({}); full syntax

No, all Appery.io applications, which are based on JQM use that method. Only AngularJS-based apps have another method to invoke services.
Please click on "Insert snippet"-"Invoke service" to get it's JS code

Return to “Issues”