We have already learnt about sharing a Postman Collection as a link. In this post we will see sharing a Postman collection as a JSON file.
A Postman Collection can be exported and imported as a JSON file. This JSON file contains all metadata of collection which helps you to import collection. This exported JSON file is useful when running with Newman in Jenkins and Command line interface.
Steps to export a Postman Collection as a JSON:-
- In the Postman app, select a collection in the sidebar and click the ellipsis (…) button.
- Select “Export” control.
A Postman collection can be imported in two versions – v1 and v2. v1 is deprecated and updated version of v2 is v2.1 which is recommended. You can read more about Difference in v1 and v2 here.
3. Select the recommended version and click on Export.
4. Select path to save file. Note the file format. It will be .json. You can modify file name.
5. Open exported JSON file in Notepad or any supported json file viewer. You will see how well API data are saved.
You can save response of API in collection as well. Follow this article to learn to save response in collection. After saving response, if you export collection, you will see details of saved response in “response” array in JSON file.
Steps to import a Postman Collection as a JSON:-
- Click on “Import” control in Postman toolbar.
2. Click on “Choose files” control and select the exported json file.
Since, I am importing collection in same Postman window, I will get a warning of “Collection Exists”. You can either replace or import as a copy. Make your choice . I will advise you to import as a copy to see imported collection separately in Postman.
Refer basics of API Testing here.
Refer detailed tutorial of Postman here.
More about API Testing in upcoming posts. Stay tuned.
If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.
#ThanksForReading
#HappyApiTesting