Best Practices for managing collections and multiple environments

Hello! I am working on trying to formalize my company’s Postman collection setup, and I’m struggling with how to best set up collection variables vs environment variables in a way that makes sense.

  • We’d like to be able to interact with multiple environments; test, staging, and production. I realize I can choose the Environment in the top right, and that’s exactly what we’re doing today.
  • We have several different microservices that have separate, distinct APIs: For example, a Slack bot, a Shipping API, an Invoice/Billing API, an Inventory Management API, handful of APIs that integrate with 3rd party CMSs, etc.

From my point of view, it doesn’t make sense for the Billing API to be able to see and access the URL or API token for the Shipping API, so that makes me think I should put the api token as a collection variable, as opposed to an environment variable. However, we have API keys for dev, staging, and production, and so if I put it as a collection variable, then I would need multiple collections, one for each environment. Which seems to defeat the purpose of having the environment switching feature of Postman.

So my question is: How do I best organize this structure? I see a few different options:

Option A: dev, staging, and production environment. Each one has the following variables:
billing-api-key
shipping-api-key
etc.

Pros: Uses environment feature of Postman, can use one collection per real API
Cons: All 12+ differrent integrations and APIs all share one giant environment variable; now I need to manage a messy list of 100+ variables.

Option B: One collection per environment: So I have a ‘billing-api-dev’ Collection, ‘billing-api-staging’ Collection, etc.

Pros: Collection variables keep API keys separate from other APIs, no giant shared list of variables
Cons: Collection management gets harder; now our workspace has 3 times as many collections to navigate through. Any updates to the API need to be sent to all 3 collections.

Option C: Separate workspaces for dev, staging, and production
Pros: Get one simple collection list
Cons: Organizational overhead of managing multiple Postman workspaces

Any advice on what you guys might be doing in your organizations would be helpful :slight_smile:

Thanks,
Matt

1 Like