We’ll start by creating a very basic collection of API requests. This automation will make checking our API a lot easier. This will allow us to see every endpoint and method for our API and we will easily be able to run the entire collection at once, easily confirming our API is operational.
There are two recommended paths I have for this:
I think both of these paths are important, you should know how to do both. So we’ll actually cover both.
We’ll be using Postman for this one which has built in collection capabilities.
Let’s start with two basic requests, one to add a row and one to retrieve all the rows.
As you build out these requests, you’ll need to save them so your changes persist to the collection.
Once you build a collection, you can click the title of the collection to open the overview. From here, you can run them all:
Selecting run will open the Runner, which allows you to run these all once or multiple times.
You’ll be able to see all the runs from the Console:
Within the test
section of the POST request to add a new favorite, add this code:
pm.environment.set('id', pm.response.json().id);