Page 1 of 1

Documentation for Rest Service object?

Posted: Mon Mar 03, 2014 3:47 pm
by Emmz

Hello.

Can you point me to an example, documentation or tell me how to to use the dropdown "object" in the Request parameters of a service.
I could find nothing on here on usage.

Thanks.


Documentation for Rest Service object?

Posted: Mon Mar 03, 2014 6:03 pm
by Maryna Brodina

Hello!

If you need to send object, you can either add fields to the object and map them separately or return object from JS code in mapping.


Documentation for Rest Service object?

Posted: Mon Mar 03, 2014 7:49 pm
by Emmz

Thanks.

I was more interested in when I create a service not when using it.
So I could specify a url that is delivered via a decryption function. That way I dont have to implement it when using the service later as its already setup.


Documentation for Rest Service object?

Posted: Mon Mar 03, 2014 8:26 pm
by Maryna Brodina

If URL is not changing, you can "specify a url that is delivered via a decryption function" and no request parameters are needed. But if it's changing use request parameters and substitution http://docs.appery.io/documentation/r...


Documentation for Rest Service object?

Posted: Mon Mar 03, 2014 8:39 pm
by Emmz

Ok so when I create a service and want to use url generated by my decrypt function. How do I do this with a generic service please??


Documentation for Rest Service object?

Posted: Mon Mar 03, 2014 8:43 pm
by Emmz

On the link you sent. Under "Basic authentication" heading.
Is that the method your referring too?
That refers to when the service is added to a page though.


Documentation for Rest Service object?

Posted: Mon Mar 03, 2014 8:48 pm
by Maryna Brodina

Not sure I understand what do you mean on "How do I do this with a generic service please"? Could you clarify what do you have at the moment and what are you trying to do?


Documentation for Rest Service object?

Posted: Mon Mar 03, 2014 8:58 pm
by Emmz

Sure.
In the Context of Creating a New REST service in Appery.
The Settings tab.
"URL" I want this to be set by a value returned by my JS.
Not {myurl} which is specified in the Request Parameters unless it can be the result of a functions returned value.

Idea being no Hardcoded URL's for future use of this service.

Currently I'm using JS to do it but only when used on a page. Can this be done when creating the service though?


Documentation for Rest Service object?

Posted: Mon Mar 03, 2014 9:35 pm
by Maryna Brodina

Not {myurl} which is specified in the Request Parameters unless it can be the result of a functions returned valuesure there can be "result of a functions returned value" - add in request parameters mapping any functions (see the screenshot)
Image Besides that you can call service from JS code by passing service URL, for example this way prerestServiceName.execute({"url":"http://someurl.com/some/service"})/pre


Documentation for Rest Service object?

Posted: Mon Mar 03, 2014 10:17 pm
by Emmz

Your using hard coded myurl in the request parameter thou....

I'm aware of the restServiceName.execute({"url":"http://someurl.com/some/service"}) and use that on some services.

I guess what I'm asking cant be done then..

So instead of using apperys invoke service in the select action. I will use javascript
var resutofDecrypt = function () {
my decryption stuff...
}
restServiceName.execute({"url":resutofDecrypt})

Thanks anyways