Configuring Multi Cluster Setup in Postman
@arvindkgsArvind Kumar GS
Passionate software developer, Linux enthusiast, clean code crusader, DIY advocate, Tech Evangelist
If you are testing REST APIs application with Oauth on Postman, generally you do the following,
- Send a OAUTH request to an /auth endpoint and copying the access token, and setting header as ‘Bearer <access-token>’ in actual request.
- This copy-paste be avoided if you set following pre-request script in pre-request tab
This will execute the Oauth request before executing the actual REST
API, and store in a global variable. So consecutive calls will utilize
the stored global variable.
Above works great for a single cluster setup.
However for a multi cluster setup, where you have one cluster in say EU data center, another in US, then you would need to duplicate this setup. I have seen developers Postman flooded with hundreds of similar requests, with only change being the URL, like below with over 184 requests
This can be avoided by using environment variables.
I have modified the pre-request script to store the access tokens, refresh token as a value object in a map with key being the cluster url. This url is set via the environment variables.
So now I can switch to different clusters easily by switching the environment.
Tags
Create your free account to unlock your custom reading experience.