How to create a Parameter of base URL while consuming the Rest API

How to create a Parameter of base URL while consuming the Rest API

  

Hi All ,

            i am trying to consume a rest API, and as per the requirement i have to change the base URL as per the environment Can I Create a parameter of BaseURL like below image. so that i can create a site property for the base URL.

If i am creating a Parameter then getting the below below error, it says the URL must be either http://host/path or https://host/path

  i went through the below post but i think its not a good practice.

https://www.outsystems.com/forums/discussion/35284/rest-api-base-url-as-an-input-parameter/


Thanks

Rajendra Singh

Hi Rajendra,

While consuming REST API, you give those input parameters in curly braces {} and later they will be input parameters. So your base url should not contain {} parameters and it should be only url where your service is hosted.

Thanks and Regards,

Suraj Borade

Solution

Hi Rajendra,

You can change your service base URL per environment (Dev,QA, etc) on 

Service Cetner -> your app -> integrations -> Consumed rest apis -> effective URL (this will override the base url defined at design time)

If you want to set it dynamically at design time, you can add an OnBeforeRequest to change the base URL of your request.

Hope it helps

Solution

Suraj Borade wrote:

Hi Rajendra,

While consuming REST API, you give those input parameters in curly braces {} and later they will be input parameters. So your base url should not contain {} parameters and it should be only url where your service is hosted.

Thanks and Regards,

Suraj Borade


Thanks Suraj.

Henrique Batista wrote:

Hi Rajendra,

You can change your service base URL per environment (Dev,QA, etc) on 

Service Cetner -> your app -> integrations -> Consumed rest apis -> effective URL (this will override the base url defined at design time)

If you want to set it dynamically at design time, you can add an OnBeforeRequest to change the base URL of your request.

Hope it helps

Thanks  Henrique Batista i have done it by OnBeforeRequest.


Thanks

Rajendra Singh