Set different api endpoints for different environments(prod, stage, preprod etc.)

I need the base URL of any api call i make to change on selecting environment, as i want to hit different base URLs for different selected environments, for example, http://hitprod.com for prod and http://hitstage.com for stage

Hey @Harsh! In the resource setup page, you can set up multiple environments and unique base URLs for each. Would something like this work for you? Let me know if you have any questions at all :blush: https://docs.retool.com/docs/using-multiple-environments

I can set up a resource query-what i am stuck on is how to change base IP for APIs that are hit in the app when environment is changed from the dropdown above. I did not find any clear steps for that configuration in the page above, could you please help out!

Hey @Harsh! Just to clarify, are you looking to change the Base URL for your API resource? If not, could you clarify a bit more about what you mean by Base IP?

Here's a quick GIF of the resource setup page showing how the Base URL changes between environments:

Jun-14-2022 21-55-37

And here's another GIF showing how you can switch environments from within your apps:

Jun-14-2022 21-57-59

Let me know if you have any questions at all! :blush:

Thanks, it is resolved!

1 Like