Creating Your First Workspace, Environment and Collection
Introduction
Starting out with Postman is key for those diving into API testing and development. This guide walks you through the basics of setting up your initial workspace, environment, and collection. Mastering these essentials will enhance your ability to test APIs and collaborate effectively.
1.Create your first collection
Postman Collections are a group of saved requests. Every request you send in Postman appears under the History tab of the sidebar.
Create your first collection
To create a new collection, you can start by creating a new request first. You can create a new request from the sidebar in Postman.
To create a collection, do the following:
If you haven't already, install the Postman desktop app and sign in to Postman.
Select New > HTTP.
Enter a request in the request builder and select Save.
Create a new collection by selecting New Collection. Enter a collection name, and then select Create.
Select Save to save the request in the new collection.
After you save the request, your new collection and the request are listed under Collections in the sidebar.
You can also create a new collection from your workspace's Overview tab. Under In this workspace, hover over Collections and select the + icon.
2.Create your first workspace
Postman workspaces enable you to organize and work together on API projects with your team. Within each workspace you can share APIs, collections, environments, and other Postman elements.
When you first open Postman, you will be in your default personal workspace.
To create a new workspace, do the following:
If you haven't already, install the Postman desktop app and sign in to Postman.
Select Workspaces in the upper left. Select Create Workspace to add a new workspace. You can also search for existing workspaces using the search bar or select one from the dropdown list.
You can use workspace templates to help you set up a new workspace. Select a workspace template to populate the workspace with helpful information and sample collections, or select Blank workspace to create an empty workspace. Then select Next.
Enter a Name and optional Summary for your workspace.
Choose who can access the workspace:
A Personal workspace is visible to you. If you're on an Enterprise team, Super Admins will also have access to any personal workspaces created within the team.
A Private workspace is visible to you and to any team members you invite to it (Professional and Enterprise plans only).
A Team workspace is visible to everyone on your team.
A Public workspace is visible to all Postman users.
A Partner workspace is visible to your team and your external partners. Learn more about using Partner Workspaces. (Postman Enterprise Ultimate plans only)
Select Create.
Postman will switch to your new workspace when you create it. You can start editing and adding to it right away.
You can move between workspaces at any time by selecting from the Workspaces dropdown list in the upper left.
3.Create an environment
Create a new environment when you want to be able to change the values of variables depending on your work context in Postman, or to share values with other team members.
To create a new environment, do the following:
Select Environments in the sidebar and select +.
Enter a name for your new environment.
Add any variables you want to the environment. You can also add variables later. Learn more about adding environment variables.
Select Save to save any environment variables you added.
To use the new environment, select it from the environment selector at the top right of the workbench. This makes it the active environment and sets all variables to the values specified in the environment. Learn more about switching between environments.
You can turn on autosave to automatically save your changes to collections, requests, and environments. Learn more about autosave.
Add environment variables
When you add a variable to an environment, you can specify the Initial value (shared) and the Current value (local) for the variable:
Initial value (shared) - This value is synced to your account using Postman's cloud servers. It's shared with any collaborators who have access to the environment. It's also made public when publishing an environment along with a collection. If the value includes sensitive data, such as a password or key, you can mask the value by selecting the secret variable type.
Current value (local) - This value is used when sending requests in your local instance of Postman. It's never synced to your account or shared with your team unless youchoose to persist it.
To add variables to an environment, do the following:
Select Environments in the sidebar and select an environment.
To add a new variable, select the bottom row of the table and enter a Variable name.
Select a variable Type. If you select default the variable value is visible in plain text. If you select secret the variable value is masked.
If a variable's initial value has sensitive data, make sure to choose the secret variable type if you don't want to expose the value when sharing or publishing the environment. Learn more about variable types.
Enter the Initial value and Current value for the variable. Keep in mind that the initial value is shared with anyone who has access to the environment, and the initial value is made public if you publish the environment along with a collection.
If you leave the current value blank, the initial value is copied to the current value when you save the environment.
When you're done adding environment variables, select Save.
Switch between environments
Postman displays the active environment in the environment selector, located in the top right of the workbench. When you send a request or run a script, Postman uses the current values for all variables in the active environment. To make another environment active, select it from the environment selector.
You can also make an environment active by selecting Environments in the sidebar. Select the set active icon
next to an environment to make it the active environment.
To check a variable's value at a glance, select the environment quick look icon
next to the environment selector. The environment quick look lists the initial and current values for all variables in the active environment.
If you want to make variables available no matter which environment is active, use global variables. The quick look lists any global variables you have declared or that are shared in your workspace.
Conclusion
As you conclude this tutorial, you've successfully established your first workspace, environment, and collection in Postman. These fundamental building blocks are essential for streamlining API testing and development. Keep exploring Postman's features to further optimize your workflow and achieve even greater efficiency.