how to covert REST API base URL to SITE property

how to covert REST API base URL to SITE property

  

Hi all,

Good day,Please suggest how we can use site/session/loc variable in REST API URL paht instead of hard coding the url value since we have problem to change the url value every time via code only while moving the code one stage(dev environment) to another stage(Testing and Production environment)

Hi Ganeshkumar Chelladurai,

Use onBeforeRequest to assign the the base URL.


Thanks 

Rajendra Singh


Solution

Hello there,

For changing the URL between environments, the *best practice* is to do it through Service Center. You can do it as seen on this document.

REST endpoint is composed by "two parts": the BaseURL (which you set on Service Center) and the URL Path which, ideally, shouldn't change between environments.

If you really want to have dynamic values on the URL Path, you can use variables, defined like this:

This way, your method will have an input parameter which is the environment - just like any other input parameter.


Let us know if this helps!


Happy (low)coding!

Solution

Thanks your help.