Table of contents
1.
Introduction
2.
Version Control
2.1.
Creating Fork
2.2.
Pull Request
2.3.
Approving Pull Request
2.4.
Merging Changes
3.
Frequently Asked Questions
3.1.
How do we make our Postman collection public?
3.2.
What is the fork environment in Postman?
3.3.
What distinguishes Postman's API from its collection?
3.4.
What is the Postman collection?
4.
Conclusion
Last Updated: Mar 27, 2024

Version Control in Postman

Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

In this article, we will read how to use version control in Postman. In Postman, we always work with our "personal workspace". Instead of a personal workspace, imagine when we are working with a team. In a team, two or three people use the same collection or API endpoints to build the request. When we come to the team workspaces, we might see a member creating some collections. Suppose we want to make changes to that collection. Even if we want to, we are not expected to go to the collection directly and make some changes. This is because it can cause some problems. So if something went wrong, we would be fully responsible for that. So for that, what we can do is we can fork those collections. Then we can apply those changes to someone to review. Version control in Postman lets us create a pull request or approve the changes and match the changes to the original collection. With the new update, we can now do this in Postman itself.

Postman Version Control

Version Control

To see the version control features, we will go to Postman now. When we look at our postman window, we can see the collections API and environment variables and marks over monitors History Etc. Below we can see that. 

Here we can see a collection. For our ease, we have created a collection beforehand. Under this, we have also added some requests. So let us assume this one is created by someone else or a team member. We now want to make changes to this. However, as our changes might cause collection problems, we will create a fork.

Creating Fork

We can see that we have a team workspace with only one member. In a team workspace, we can name anything and add team members. Whenever we want team members, we can add them, or if we want to invite them, we can invite them via email or a link. That is when we can work in team collaboration. If two or three people are working in the same workspace, they can make some changes upload them, save and measure them.

So now we have created this collection previously and want to fork it. 

Besides the folder icon we see here, we find a three-dot icon. Once we click on this one, we will see the option called create the fork. When we do this, it asks for some fork label. We will name it "my label". So when we click on the create collection, we can see one more collection folder by the same name. So we are clicking on the fork collection. Now we can see the fork created. 

Creating a fork.

Here we can see that one more collection folder will be created. 

One more Collection folder created.

Now let us assume we have our original collection and do not want to make changes to this. So what will we do? We will come to the fork we have created. Then we will make the changes I want to make to the fork. Now we will add some test cases again. 

Looking at the test Results

We will navigate the status code. When we go to the test result, we can see that the status code is coming as "200". Now we have made some changes to this duplicate collection. Alternatively, we can say another version of a collection we made through the fork. However, we should also see no change in the main collection file.

Pull Request

So we want to match this collection to our original collection. What we have to do is, once the forking is done, we can go for the create a pull request.

Creating the Pull request by selecting the option

So once we have made some changes, someone has to review or approve our changes. So when we work as a team, our senior has to review, and they have to approve. That is the reason we have to go for this and create a pull request.

We have to give a title stating the changes made. We can give some descriptions and add some reviewers. Along we can select more people. So for this case. We do not have any other users because we work in our workspace with only one member. When we go for a team, we can select the senior above us for approval. For now, we will add ourselves here. We can select up to fifty people.

Approving Pull Request

Now let us see how the approval to Pull Requests works. Here we have selected our own name and are clicking on the create a pull request. Our pull request has been made. We can see the approve button because we gave our name as the approver. That is the reason we see the approve button.

Approving the Changes made

So what we will do now is we will click on this approval. Before that, we can see the changes. So once we click on approve, it will be approved. We can see a successful upgrade message, and the status changes to approved.

Merging Changes

So now we can go to the same collection again and go for the merge changes. So we have made some changes and requested a pull request. And seek approval. After that, we have to go for merging changes. Once this approval is done, we can go for a merge. When we go to merge, it asks for the merge of all changes. These are the changes we have made. We have added this postman test. So we have written one test from our fork collection, and now we have to merge all changes. We have to make these changes to our fork collections and base collection. We can see all the options when we click on merge all changes.

Merging all Changes option.

Selecting the first option, "merge changes", is where the destination will be updated with the changes. We can select the second option also, merge changes and update the source. The source is the fork collection, so if we select this one, which will merge the changes and delete the source.

Different Merging Options

We can see below that it will be updated to the original collection when we click on the selected option. The source will be deleted, and now we can see after clicking on the merge button that the second new collection will disappear from our postman workplace. We can see it is gone. The changes we make in the merge section gets reflected in the collection section.

Updated to original collection

Frequently Asked Questions

How do we make our Postman collection public?

We choose Workspace Settings from the Overview tab. Request to Change Visibility after selecting Public from the selection list under Visibility. The workspace in the Postman header becomes publicly available after we make a workspace public, making all things included in that workspace accessible to anyone.

What is the fork environment in Postman?

The workspace environment is duplicated by forking. The original copy will not be harmed if a forked copy is modified and used. We can distinguish this fork from the original and other forks thanks to the fork label, which is required. Workspace(required) Choose the workspace you wish to fork in.

What distinguishes Postman's API from its collection?

Data about the endpoints is fetched from the Postman cloud using API. Simply a library for working with the received json file, Collections SDK.

What is the Postman collection?

Several saved requests are gathered into Postman Collections. In Postman, each request we make is recorded under the History tab in the sidebar. The history section makes it simple to reuse requests on a small scale. Finding a specific request in history can take some time as Postman gains popularity.

Conclusion

In the article, we read about version control in Postman. We saw the different elements of version control in postman and found their uses. We also saw about the process of making changes to our collections in Postman. We found out how to seek a review of changes made and merge the files to implement them. Check out blogs and find out about React Native State and Installing and Running Newman in Postman. If you’re interested, you can find out How to Collaborate on Postman or How to Write Tests in Postman and run them with Monitors. Have a look at our blogs on APIs and API Testing to explore. You can discover all about web testing too. Explore Coding Ninjas Studio to find more exciting stuff. Happy Coding!

Thank you

Live masterclass