Any time you're working with an API, whether it is a third-party API or internally developed, it is helpful to be able to rapidly test as you go, to ensure your requests and responses are working as expected. There are a lot of considerations when integrating with an API, including headers, request methods, different body formats, and authentication methods, so in turn, there are a lot of things that can go wrong.
This post is going to take a look at a few API testing tools I've used extensively over the years (cURL, VS Code REST Client, and Postman), as well as one that is new to me (Paw). This is not going to be a detailed feature-by-feature comparison, but I will share my experience (or lack thereof) with these tools and provide links to additional details.
cURL (aka Quick and Dirty #1)
cURL was created in 1996 by a Swedish developer named Daniel Stenberg. It's easy to use, supports a vast array of protocols, and although it is not specifically designed to be a testing tool, it has always been a popular tool for quick and dirty API tests. cURL comes pre-installed on most Windows, macOS, and Linux machines, so if you have a computer, you probably already have cURL. That alone is a great reason to give it a try.
To do your first HTTP get request with cURL, just pop open your terminal of choice and type:
curl -i https://api.nextform.app
The -i flag shows the response headers. This is the health check endpoint of Nextform's API service and all it does is provide a 200 OK response. Often times, there's nothing faster than busting out cURL when you need to test something quickly, so learning some cURL basics can really speed up your development process. Check out this getting started guide and keep cURL in your toolbelt!
VS Code REST Client (aka Quick and Dirty #2)
Two million users can't be wrong. This VS Code plugin is popular because it makes creating and sending HTTP requests super easy, and it does it from within a text editing tool you probably already use. As with cURL, this is not specifically designed for testing, it is more of a general-purpose exploration tool. You write the requests in your editor, where you can save them for later as a .http file. Responses appear in a separate tab.
This can be a great tool to reach for when you are designing an API and you have not yet solidified your API design choices. All of the elements of the request are easy to see and edit quickly, as opposed to one of the GUI options below, where you may need to drill down through layers of menus to tweak one part of your request.
Postman (Getting Serious Now)
Now we're really in testing land. Postman has been my go-to testing tool for several years. Not only is it a versatile HTTP client, it provides a robust suite of tools for API testing. This is the type of software you'll want to reach for once your API is fleshed out and you want to be able to re-run regression tests to ensure uptime for your API users.
Some of my favorite features are:
- Environments that allow you to set up variables and incorporate them throughout your tests. This allows you to do things like switch between development and production environments quickly so that you can write one set of tests that handle all of your deployments.
- Pre-request scripts. I sometimes use a pre-request script to generate some random data (Postman has the faker library built in) such as a random email address to test a signup endpoint. Postman uses a random data generation library to make this super easy to do.
- Chaining requests. Sometimes you need to make a request based on the response of a previous request. This is easy enough to do by saving variables to your environment then using those values in the next request.
You'll find that the remaining tools in this review support most of the above features, even though each tool takes a slightly different approach, so I won't cover them in detail below.
Paw is for macOS only, and it's $49.99 for a perpetual license. That will probably be a roadblock for a lot of users, considering Postman gives you most of its features for free. However, when you dig in to Paw, you'll see that it has a beautiful UI and all the built-in features you could ask for. In addition, it is a native macOS app, which means that the user experience is going to be a little smoother and a little less resource-intensive than an Electron app. The native app aspect is very appealing thing to me.
One interesting feature is the ability to migrate requests from Postman. They are really gunning for the Postman users here. cURL commands can also be imported. If you think Paw may be worth the investment to you, they offer a free 30-day trial when you click on the "Get Paw" button.
Honorable Mention: Insomnia
Insomnia is another popular choice. I did not feature it above because it has many of the same features as Postman and Paw, but it relies more on a plugin community for certain features. That said, it is a little friendlier looking and a not as overwhelming as something like Paw or Postman when you first open it up, so if your needs are just above that of say cURL or REST Client, but somewhere below Postman or Paw, Insomnia may hit the mark for you.
By the way, did you know that Nextform offers an amazing API that makes it easy to collect forms like W-9 and W-8BEN? If you want to experiment with these API tools, why don't you set up a free Nextform account and try creating a session?