Introduce a new Variable Scope - Folder Variable

Hi, I have a use case where I have an API collection that was used for one product (Assume product A). Inside the API collections, there are finer categorization of different API calls categorized by their subpaths as follows:
http://{{host}}:{{port}}/{{subpath}}

where each subpath is categorized by the folders shown in screenshot below.
image

Each folder in the API collection is referring to a different microservice, and they would have different subpaths, eg.

/ProductA/Auth
/ProductA/Asset

As a user, i also have a lot of other API collections for other products, so it would be best (if possible) if i do not use different API collections for different microservices, since they are all related to a single product in this case.

Hence, imo, it would be best if there’s a finer variable management at folder level as well, so that users can use Collections for storing product based APIs and Folder for storing microservices based APIs.

This already exists, unless I misunderstand your question.

You can set your url for each endpoint to something like

https://{{Product}}/{{FolderName}}

Then, right click on the folder, click on Edit and then in the Pre-Request tab, add this code:

pm.globals.set(“FolderName”, “Auth”); // (or whatever the folder name is).

Do this Pre-Request add for each of your folders, setting the var to the Folder’s name.

Poof. Done.

1 Like