Postman recently introduced mock servers allowing developers to simulate an endpoint without spinning up a back-end server. Today, Postman is announcing Examples to take it one step further, or to be precise, one step earlier in the API development lifecycle.
Developers can mock a request and response in Postman before sending the actual request or setting up a single endpoint to return the response. Establishing an Example during the earliest phase of API development requires clear communication between team members, aligns their expectations, and means developers and testers can get started more quickly.
What is an example?
A new custom response
Examples let you define what the response should look like by letting you create your own custom responses from scratch. The illustration below outlines the steps for creating an example with a new response.
- Click on the Examples dropdown.
- Click the Add Example button. The base request gets loaded as ‘example request‘ in the examples editor.
- Enter the name of your example.
- Edit the request part of the example.
- Enter a status code.
- Create a new response for your example.
- Click the Save Example button in the upper right corner of the builder to save your example.
The response received from the server
After you’ve received a response from a server, you might want to save the current request and response pair as an example. Steps for doing so are similar to creating a new response from scratch.
Accessing your saved examples
What happened to the ‘Save Response’ feature?
This allows teams to mock an example request and response, along with simulating the endpoint using mock servers. Front-end and back-end developers and testers can all begin working in parallel, based on the agreed-upon example.
As always, the Postman team loves hearing feedback from the community, and based on your input, we work hard to build features that support you throughout the entire API development lifecycle. Examples are a simple, but powerful, way to get started more quickly and efficiently.
Examples are out on our Canary build, and will hit our stable builds this week.Check it out, and let us know what you think!
Update: Examples are currently available in our stable builds.