Checking API responses
Since Postman uses JavaScript for the checks in a test, it has a lot of power and flexibility built into it. I'm going to walk you through various things that you can do with this. In order to do that, it will be easiest to work with actual API calls. For that purpose, I will once again use the Star Wars API (https://swapi.dev). If you don't have one yet, create a collection in Postman called something like Star Wars API – Chapter 6 and in that collection create a request called Get First Person. This request should call the /people/1
endpoint from the Star Wars API. You can also download the collection from the GitHub repository for this course (https://github.com/PacktPublishing/API-Testing-and-Development-with-Postman/tree/master/Chapter06) and then import that package, if you would prefer.
When I made this collection, I also created a variable called base_url
that specifies the base URL for this. I will be creating a few different requests...