15. API development with Postman


An excellent tool for API development is Postman. It makes it really easy to smoke test your API endpoints, saving you from having to use curl or the browser, like did in the last video,

If you don't have it installed, go ahead and do so, I'll put the link below the video.

Creating a request

When you first open Postman, it'll ask if you want to create, so go ahead and click "Request".

The request name will be "GET /items", as that's the first request we'll smoke test with Postman.

Next, you'll want to add your request to a collection, since over the duration of the course we'll have many different requests to work with.

I suggest you create a collection called "PrintBay" and save it to that.

Setting up GET /items

In the URL at the top we can put the URL we want to test, in our case, http://localhost:8080/items.

With that done, press "Send". You'll see the response in the response window.

We can now go ahead and Save that request by clicking "Save", ensuring that each time we open Postman we can quickly smoke test that endpoint.


One cool thing you can do with Postman is use environment variables in your requests.

Since all of our requests have the same domain, just a different URI, it would make sense to make the domain a variable.

Let's update the URL so that the domain is replaced by a variable url. We can use moustach syntax just like in Vue.


If we try to Send that, obviously it won't work since we haven't set a value for that yet.


To create a value for that variable, let's press the gear icon and add a new environment.

Name the environment something like "My Macbook". We can now add url as a variable and set its initial value to http://localhost:8070.

Now we can click add and the environment is created.

Back in the main window, let's select that new environment. We can now Send our request, and this time it works.