Maintain your public APIs for the Postman API Network

View as Markdown

If you prepared a team workspace for team collaboration, you can draft your next release there. Otherwise, you can update your changes in place in your public workspace.

To get started, open your team workspace and update your team collection. Your team collection is the fork of your public collection.

Update your public collections with a pull request

For these steps, you’ll use Postman version control to update your public collection. You can draft your changes in your team workspace. When you’re ready to share your changes with your API consumers, you can publish your changes to your public workspace by merging your pull request.

Create a pull request to merge to your public collection

To create a pull request to merge to your public collection, do the following:

  1. Open your team workspace and the collection you updated.
  2. Next to your collection, click Options icon View more actions. Then, click Create pull request.
  3. Enter a title and description, and add reviewers.
  4. Click Create Pull Request.

To learn more, see Create a pull request to contribute to an element you forked.

Review, approve, and merge the pull request to your public collection

To review, approve, and merge the pull request to your public collection, do the following:

  1. Open your team workspace and the collection you updated.
  2. In the right sidebar, click Merge icon Pull Requests.
  3. Click the pull request’s title.
  4. Review the pull request’s changes.
  5. If you want to add a comment, click Comments icon Comments. Then, add a comment and click Comment.
  6. If you approve the pull request, click Pass icon Approve.
  7. If the pull request is ready to merge, click Merge. Then, choose how you want to merge and click Merge.

Postman merges your changes to your public collection and makes them available to your API consumers.

To learn more, see Review pull requests in Postman.

Update your public collections with the Postman API

For these steps, you’ll use the Postman API to update your public collections. You can draft your changes in your team workspace. When you’re ready to share your changes with your API consumers, you can publish your changes to your public workspace with a couple of API calls.

Create a new collection in your team workspace

Test your workflow in a new Postman Collection first, before you integrate these steps in your continuous integration and continuous delivery (CI/CD) pipeline.

To create a new collection in your team workspace, open your team workspace. Then, in the left sidebar, click Add icon Add > Collection icon Collection.

To learn more, see Create a new collection.

Save your collection IDs as variables

To save your collection IDs as variables, do the following:

  1. Open your team workspace and the collection you updated.
  2. In the right sidebar, click Info icon.
  3. Click Copy icon Copy collection ID. Postman copies the collection ID to your clipboard.
  4. Create a new variable and save the collection ID to it. Save it in your team workspace and name the variable something memorable, such as apiReferenceTeamCollectionId.
  5. Open your public workspace and the collection you want to update, and save its collection ID to another variable. Save it in your team workspace and name the variable something memorable, such as apiReferencePublicCollectionId.

You’ve saved two new variables in your team workspace, which you’ll use in the next steps.

To learn more, see Store and reuse values using variables.

Get your collection with an API call

To get your collection with an API call, do the following:

  1. Open your team workspace and the collection you created for this workflow.
  2. Add a request to your collection.
  3. Click GET and enter https://api.getpostman.com/collections/:collectionId.
  4. Open the Params tab and, for the collectionId path variable, enter the variable name for your team collection ID. For example, enter apiReferenceTeamCollectionId.
  5. If you haven’t already, open the Authorization tab and set up authentication and authorization.
  6. Click Send.

Postman returns your team collection as a JSON object.

To learn more, see Get a collection.

Update your public collection with an API call

To update your collection with an API call, do the following:

  1. Open your team workspace and the collection you created for this workflow.
  2. Add a request to your collection.
  3. Click PUT and enter https://api.getpostman.com/collections/:collectionId.
  4. Open the Params tab and, for the collectionId path variable, enter the variable name for your public collection ID. For example, enter apiReferencePublicCollectionId.
  5. If you haven’t already, open the Authorization tab and set up authentication and authorization.
  6. Open the Body tab and add the team collection JSON object from the previous procedure. Remember to remove any IDs from the object, such as _postman_id, id, and uid. You can automate this step with a script.
  7. Click Send.

Postman updates your public collection and makes your changes available to your API consumers.

To learn more, see Replace a collection’s data.