352
Views
4
Comments
Solved
Different environment REST API 
Question

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

2017-07-05 22-17-18
Henrique Batista
Staff
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

2020-02-28 09-46-54
Eduardo Jauch

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.


2017-07-05 22-17-18
Henrique Batista
Staff
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

2020-02-28 09-46-54
Eduardo Jauch

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.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

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.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.