Getting Started With Postman Templates
04 Oct 2019
I am getting ready for my first API event as the Chief Evangelist for Postman—API World next week. To help prepare us, Joyce Lin (@PetuniaGray), fellow developer relations team member shared some Postman templates with me, equipping us with some of the most useful examples of using Postman she uses in her talks. I thought I was a proficient Postman collection user until I began working at Postman, where I quickly realized that I have a lot of work ahead of me to learn all the ways of doing interesting API things with Postman collections and templates. Making them perfect little portable learning objects, demonstrating how to accomplish a handful of API-driven tasks, or even more relevant workflows.
You can find Postman templates in the Postman API development environment (ADE) by clicking on the big orange “New” button in the top left corner of the application—it is a tab on the popup window that comes up. You can browse by category, or you can search using a keyword. Here are three of the templates that Joyce shared with us:
- Visualizer Examples - This collection contains two sample templates for visualizing data returned as part of an API response, one rendering data as a table, and the other renders data as a bar graph.
- Intro to Writing Tests - This collection contains examples of tests that you can use to automate your testing process. Includes basic test syntax, examples of API tests, and integration tests.
- Working with GraphQL - This collection introduces you to the GraphQL functionality that Postman supports, demonstrating how Postman can be used for more than just working with web APIs.
While playing around with Postman templates, I came across a handful of others that I think are interesting in what they deliver, but also in the way that they demonstrate how Postman templates, and the resulting collections can be used for so much more than just API reference:
- MOCKS: fake it till you make it - Use the Postman API to generate and manage mock servers, and automate the virtualization of your API infrastructure as part of an API first approach.
- Postman Expert Training - EX1.1 - Collection to demonstrate the use of environment variables and their behavior in the Collection Runner
- Reverse engineering an API - From inspecting a single HTTP request to monitoring a stream of requests, here's how you can use Postman to capture and visualize this HTTP traffic.
- Extract data to chain requests - Extract data from the response. This is useful to capture authorization, session, or cookie data or parse information (e.g. XML or JSON) available within the response body to chain requests and use this data in a subsequent request.
You can find all of these Postman templates by using the search available in the templates tab. I’m going to be going through all the different templates, better understanding the different approaches behind them—reverse engineering why they matter. Templates are a pretty compelling way to rise above the purely reference nature of most API definitions like OpenAPI and Postman collections, demonstrating how Postman collections break into new territory and help us define workflows, tutorials, and other interesting and useful ways to sharing useful and executable nuggets of API value.
If you want to shift your view of the API landscape I recommend playing around with Postman templates. Find one or two that you find interesting, and begin pushing your understanding of collections into new territory. I am looking forward to getting more proficient in using them, and be able to quickly whip up different types of workflows, and useful API-driven solutions for developers and non-developers. I feel like they represent a lot of the potential creativity and imagination I feel was missing from Swagger and OpenAPI. Not the it wasn’t possible, but I think the tooling enablement that was going on was very narrow (docs, codgen)--lacking imagination. Postman collections and templates represent a more empowering approach to API definitions, taking them beyond just reference implementations, and help us truly see the value of individual as well as multiple APIs working in concert.