1. Introduction
Postman is a popular tool for API development and testing. It allows you to create, organize, and share collections of requests that can be executed against any API. Collections are useful for documenting, testing, and automating your API workflows.
But what if you want to publish or export your Postman collections for external use? For example, you might want to share your collection with other developers, embed it on your website, or download it as a file for backup or offline use.
In this tutorial, you will learn how to publish and export your Postman collections using web and API. You will learn how to use Postman web and Postman API to perform these tasks. You will also learn the benefits and limitations of each method, and how to choose the best option for your needs.
By the end of this tutorial, you will be able to:
- Publish your Postman collections to a public workspace using web
- Share the collection link or embed code with others using web
- Export your Postman collections as JSON or HTML files using web
- Publish and export your Postman collections using Postman API
Ready to get started? Let’s begin with publishing your Postman collections using web.
2. How to publish Postman collections using web
One of the easiest ways to publish postman collections is to use the web interface of Postman. This method allows you to create a public workspace and publish your collection to it. You can then share the collection link or embed code with others, who can view and run your collection online.
To publish your Postman collections using web, you need to follow these steps:
- Create a public workspace
- Publish your collection to the workspace
- Share the collection link or embed code
Let’s look at each step in detail.
2.1. Create a public workspace
A workspace is a shared environment where you can collaborate on your Postman collections with other users. You can create different types of workspaces, such as personal, team, or public. A public workspace is a workspace that is visible to anyone on the web. You can use a public workspace to publish postman collections and share them with the world.
To create a public workspace, you need to follow these steps:
- Log in to your Postman account and go to the workspaces page.
- Click on the Create New button and select New Workspace from the dropdown menu.
- Enter a name and a description for your workspace. You can also add a logo and a summary.
- Under Visibility, select Public. This will make your workspace accessible to anyone on the web.
- Under Invite, you can add collaborators to your workspace. You can also skip this step and invite them later.
- Click on the Create Workspace button to create your public workspace.
You have successfully created a public workspace. You can now publish your collection to it.
2.2. Publish your collection to the workspace
Once you have created a public workspace, you can publish your collection to it. This will make your collection visible and runnable on the web. You can also update your collection anytime and the changes will be reflected on the web.
To publish your collection to the workspace, you need to follow these steps:
- Go to the collections page and select the collection you want to publish.
- Click on the Share button and select Share Collection from the dropdown menu.
- Under Share to a workspace, select the public workspace you created in the previous step.
- Click on the Share Collection button to publish your collection to the workspace.
You have successfully published your collection to the workspace. You can now share the collection link or embed code with others.
2.3. Share the collection link or embed code
After you have published your collection to the public workspace, you can share the collection link or embed code with others. This will allow them to view and run your collection online, without having to download or import it. You can also customize the appearance and functionality of your collection on the web.
To share the collection link or embed code, you need to follow these steps:
- Go to the workspaces page and select the public workspace where you published your collection.
- Click on the Collections tab and select the collection you want to share.
- Click on the Share button and select Get public link or Embed from the dropdown menu.
- If you choose Get public link, you will see a URL that you can copy and share with others. You can also enable or disable the link anytime.
- If you choose Embed, you will see a code snippet that you can copy and paste into your website or blog. You can also customize the theme, layout, and behavior of your collection on the web.
You have successfully shared the collection link or embed code with others. They can now view and run your collection online.
3. How to export Postman collections using web
Sometimes, you might want to export postman collections as files that you can store locally or share offline. For example, you might want to backup your collection, import it into another tool, or send it as an attachment. You can export your Postman collections as JSON or HTML files using the web interface of Postman.
To export your Postman collections using web, you need to follow these steps:
- Go to the collections page and select the collection you want to export.
- Click on the … button and select Export from the dropdown menu.
- Choose the export format and the version of your collection. You can choose between JSON and HTML formats, and between v1 and v2 versions. The JSON format is the standard format for Postman collections, while the HTML format is a human-readable format that you can view in a browser. The v1 version is the older version of Postman collections, while the v2 version is the newer and recommended version.
- Click on the Export Collection button to download the collection file.
You have successfully exported your Postman collection as a file. You can now store it locally or share it offline.
3.1. Select the collection to export
The first step to export postman collections using web is to select the collection you want to export. You can export any collection that you have created or imported in your Postman account. You can also export collections from any workspace, whether it is personal, team, or public.
To select the collection to export, you need to follow these steps:
- Log in to your Postman account and go to the collections page.
- Find the collection you want to export and click on it to open it.
- Make sure that the collection is up to date and has all the requests and settings that you want to export.
You have successfully selected the collection to export. You can now choose the export format and version.
3.2. Choose the export format and version
The second step to export postman collections using web is to choose the export format and version of your collection. You can choose between JSON and HTML formats, and between v1 and v2 versions. The JSON format is the standard format for Postman collections, while the HTML format is a human-readable format that you can view in a browser. The v1 version is the older version of Postman collections, while the v2 version is the newer and recommended version.
To choose the export format and version, you need to follow these steps:
- After selecting the collection to export, click on the … button and select Export from the dropdown menu.
- A dialog box will appear, asking you to choose the export format and version.
- Select the format that you want to export your collection as. You can choose between JSON and HTML. The JSON format will export your collection as a JSON file, which you can import into Postman or any other tool that supports JSON. The HTML format will export your collection as an HTML file, which you can view in a browser or embed in a website.
- Select the version that you want to export your collection as. You can choose between v1 and v2. The v1 version will export your collection as the older version of Postman collections, which has some limitations and compatibility issues. The v2 version will export your collection as the newer and recommended version of Postman collections, which has more features and functionality.
- Click on the Export Collection button to proceed to the next step.
You have successfully chosen the export format and version of your collection. You can now download the collection file.
3.3. Download the collection file
The final step to export postman collections using web is to download the collection file. You can save the file to your local device or upload it to a cloud storage service. You can also open the file in a text editor or a browser, depending on the format you chose.
To download the collection file, you need to follow these steps:
- After choosing the export format and version, click on the Export Collection button.
- A dialog box will appear, asking you to choose a location to save the file. You can browse your device folders or select a cloud storage service.
- Enter a name for the file and click on the Save button.
- The file will be downloaded to the location you chose. You can now access the file anytime.
You have successfully exported your Postman collection as a file. You can now store it locally or share it offline.
4. How to publish and export Postman collections using API
Another way to publish and export postman collections is to use the Postman API. This method allows you to programmatically access and manipulate your Postman collections using HTTP requests. You can use the Postman API to publish and export your collections from any platform or tool that supports HTTP requests.
To publish and export your Postman collections using API, you need to follow these steps:
- Generate an API key
- Use the Postman API endpoints
- Retrieve the collection URL or file
Let’s look at each step in detail.
4.1. Generate an API key
An API key is a unique identifier that allows you to access and use the Postman API. You need an API key to publish and export postman collections using API. You can generate an API key from your Postman account settings.
To generate an API key, you need to follow these steps:
- Log in to your Postman account and go to the API keys page.
- Click on the Generate API Key button.
- Enter a name and a description for your API key. You can also choose the level of access for your API key, such as read-only or read and write.
- Click on the Generate API Key button again.
- A dialog box will appear, showing you your API key. You can copy the API key to your clipboard or download it as a file.
- Click on the Done button to close the dialog box.
You have successfully generated an API key. You can now use the Postman API endpoints to publish and export your collections.
4.2. Use the Postman API endpoints
The second step to publish and export postman collections using API is to use the Postman API endpoints. The Postman API provides a set of endpoints that allow you to perform various operations on your Postman collections, such as creating, updating, deleting, and exporting. You can use these endpoints to publish and export your collections programmatically.
To use the Postman API endpoints, you need to follow these steps:
- After generating an API key, you need to include it in the header of your HTTP requests. The header name is X-Api-Key and the value is your API key.
- You need to use the base URL of the Postman API, which is https://api.getpostman.com.
- You need to use the appropriate endpoint for your operation. For example, to publish your collection, you need to use the /collections/publish endpoint. To export your collection, you need to use the /collections/export endpoint.
- You need to provide the required parameters for your operation. For example, to publish your collection, you need to provide the collection ID and the workspace ID. To export your collection, you need to provide the collection ID and the export format.
- You need to send the HTTP request and handle the response. The response will contain the status code, the message, and the data. For example, if you publish your collection successfully, the response will contain the status code 200, the message “Collection published successfully”, and the data with the collection URL. If you export your collection successfully, the response will contain the status code 200, the message “Collection exported successfully”, and the data with the collection file.
You have successfully used the Postman API endpoints to publish and export your collections. You can now retrieve the collection URL or file.
4.3. Retrieve the collection URL or file
The final step to publish and export postman collections using API is to retrieve the collection URL or file. Depending on the endpoint you used, you will get either a URL or a file as the data in the response. You can use the URL or the file to access and use your collection externally.
To retrieve the collection URL or file, you need to follow these steps:
- After sending the HTTP request to the Postman API endpoint, you need to check the response status code and message. If the status code is 200 and the message is “Collection published successfully” or “Collection exported successfully”, then your operation was successful.
- You need to extract the data from the response. The data will contain either the collection URL or the collection file, depending on the endpoint you used. You can use a JSON parser or a text editor to view the data.
- If the data contains the collection URL, you can copy and paste it into your browser or share it with others. The URL will take you to the Postman web interface, where you can view and run your collection online.
- If the data contains the collection file, you can save it to your local device or upload it to a cloud storage service. You can also open the file in a text editor or a browser, depending on the format you chose.
You have successfully retrieved the collection URL or file. You can now use your collection externally.
5. Conclusion
In this tutorial, you have learned how to publish and export your Postman collections using web and API. You have learned how to use Postman web and Postman API to perform these tasks. You have also learned the benefits and limitations of each method, and how to choose the best option for your needs.
By publishing and exporting your Postman collections, you can share your API workflows with others, embed them on your website, or download them as files for backup or offline use. You can also use your collections externally, such as in other tools or platforms that support HTTP requests.
Postman is a powerful tool for API development and testing. It offers many features and functionalities that can help you create, organize, and share your collections. You can explore more of Postman’s capabilities by visiting the Postman Learning Center.
We hope you enjoyed this tutorial and found it useful. If you have any questions or feedback, please let us know in the comments below. Thank you for reading!