Different environment REST API

Different environment REST API

  

Hello Everyone 

I need to call the REST API. each environment the API base URL is different, How i need to manage this. Do i need to change the base URL in each environment OR is there another way to manage this. Your help is highly appreciated.


DEV : "https://devAPI/......" 

QA : "https://QAAPI/......"

PROD: "https://PRODAPI/......" 

Regards

Sajesh

Hello sajesh

You will need to add an OnBeforeRequest event to your consumed REST web service.
In it, you can change the base URL in runtime (CustomizedRequest.BaseURL).

See here for more detail: https://www.outsystems.com/forums/discussion/16898/change-dynamically-rest-api-url/

Cheers.


Solution

Hi sajesh,

Just building up on Eduardo's answer, alternatively you can change it on Service center, so you can have base URLs per environment (dev.tst, prod etc) without touching code.

Just go to service center -> your module -> Integrations -> click on the desired REST and change the effective URL.

More details here

Cheers

Solution

For the case where the endpoint changes because of Infrastructure, like it seems the case, with different endpoints for different purposes, Henrique's answer seems more appropriated, indeed :)

To change in run time would be usefull if you need to change the end point in the same environment.

Yes, Henrique's answer is probably what Sajesh is looking for. If you have different base URLs in different environments, Service Center is the place to manage that.