Creating good mock responses
When we created the API specification as shown in the previous chapter, we added a few examples. Postman will attempt to use those examples along with the default values in the specification to create responses for your mock calls. However, the default stuff that Postman sets up will need to be customized a bit to our specific needs.
In this section, I will show you how to use Postman to create good mock responses. We will look at the following topics:
- Using default examples
- Creating your own custom examples
- How to use dynamic variables in your examples
- How to give different responses based on different path parameters
- How Postman picks which example to return to you
This sounds like a lot, but we will work through it one step at a time and by the end of this section, you will have a good grasp of how to use examples in Postman to create useful mock responses. Let's start by looking at some of the default examples...