Jitendra Bhagat
Posts: 0
Joined: Tue Apr 29, 2014 8:56 am

How to Set the Service url Dynamically

Hi Team,

I want to set the Service Url dynamically that is I want to hardcode the common part of the URL in some javascript file that is in my code and use {url}/login .. {url}/search, . etc... is it possible and how to do that.

I tried hardcoding the common part of the url in a ".js" file in my code.

But that did not worked.

Any suggestions.

Thanks in advance.

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

How to Set the Service url Dynamically

Hi Jitendra,

In URL, add values in curved brackets as you wrote:pre{url}/login .. {url}/search/preThen add the 'url' request parameter. Appery.io will automatically replace {url} with this parameter value.

Jitendra Bhagat
Posts: 0
Joined: Tue Apr 29, 2014 8:56 am

How to Set the Service url Dynamically

Hi Katya,

Thanks for the reply.

But I do not want to add the 'url' request parameter as I have multiple screens and it would not be a good idea to create 'url' parameter for all of them ..

Why I cannot hardcode the common part in some ".js" file ?

Waiting for a favorable reply.

Thanks in advance.

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

How to Set the Service url Dynamically

Hi Jitendra,

Specify the common part in URL, outside the curved braces, for example:preexample.com/{param1}/preIf you specify request parameter param1=forum, then there is the following URL:
example.com/forum

In this example the common part 'example.com' remains the same for all services.

Jitendra Bhagat
Posts: 0
Joined: Tue Apr 29, 2014 8:56 am

How to Set the Service url Dynamically

Is it possible to define

var param1='forum' ; in some ".js " file in the Appery code , as I want to avoid making a new request parameter 'param1'.

Waiting for a favorable reply.

Thanks in advance.

Jitendra Bhagat
Posts: 0
Joined: Tue Apr 29, 2014 8:56 am

How to Set the Service url Dynamically

Hi Katya,

I want to declare the common part of the URL in a global variable :-

var url= 'http://example.com' ;in a javascript file and use this variable in the Service URL everywhere. like... URL : {url}/login.. {url}/search .... {url}/details, etc... Did you understood what I mean to say ?

So that I do not need to create request parameter in every service that I am using.
Is it possible what I want to achieve by the above idea..?

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

How to Set the Service url Dynamically

Hi Jitendra,

Yes, to do it add this variable in Service Settings:
http://devcenter.appery.io/documentat...

Return to “Issues”