How to Test APIs From the Command Line With HTTPie and cURL

In this installment of our API Testing Series we look at two command line tools – HTTPie and curl. Both of these tools are ideal for exploration. Along the way, you will create a couple of API tests running against the Trello API, which is a real API with formal authentication tokens.

Today in our API Testing Series we'll take a look at two command line tools – HTTPie and curl. Along the way you'll create a couple of API tests running against the Trello APITrack this API, which is a real API with formal authentication tokens. ( is a project management tool.) You'll need a little setup to follow along with the review and to interact with the Trello API. You'll also need to create an account on and generate an application key and a token to use the Trello API. Unlike most of the other tools discussed in our series that involve a user interface (like Postman) or involve code (like Airborne), HTTPie and Curl are both command line tools. You can install the latest version of HTTPie at this link. You can install the latest version of curl from this link, or if you're on a Mac or *NIX system, it may already be installed.

When to use

Both of these tools are ideal for exploration. A developer might create a new API endpoint, or edit an existing one and commit her changes to the source code repository. Once the change is live on a server, a tester can access the changes. That tester might have a longer-term goal of performing test automation with a tool like SmartBear Ready API or Postman, but exploration is where things start. From the command line, a tester can make one API call at a time, make observations about the response, and then make more calls based on what she learned. This process helps to discover bugs that wouldn't be found by the sometimes superficial automated tests running in CI, and it also helps technical staff to learn the new API change.

An easy onramp to curl

Go to, right-click in the white space on the web page, and select View Source. At the command line, type in "curl" Note that the response is essentially identical to the source observed after clicking View Source. Curl stands for "c url" or "see url," and implies that text will be retrieved from a web query. Go back to the browser, type in "software," and click the search button. Notice the URL changed to Try to curl that and you'll get a SSL certificate error. But if you remove the "s" from "https," making the call "http" instead of "https," and you'll get a copy of the page source in your response. That response will look something like this:

Example: curl

Calling curl from the command line is as easy as passing in the web page you'd like to download, plus dealing with authentication. Let's talk about how to do that with Trello.

Curl example

Open a new command prompt and enter in the following command:


YOURIDLISTVALUE in the above snippet refers to a piece of data that is required when POSTing to the Trello API's /cards resource. You can read about that here. Here is a quick breakdown of the command:

  • Curl invokes the curl program
  • The -F parameter means you're sending form data to the server in addition to the name/value pair following the data sent
  • After that is the URL you're POSTing to. You'll probably notice that the URL is in quotes. This is because you're sending two authentication parameters as part of the query string. Curl will reach the ampersand and stop reading at the line without the quotes.

Enter the API call as follows (making sure to substitute your own parameters for idList, key, and token):

curl -F idList=58c6ea575b0858ee3ef5fc56 ""

Hit Enter and you'll see something that looks like:


should be one line and look something like { "idList": "123456abcd" }.

This is the response from the Trello server. You can read more about curl usage in the man page here.

HTTPie example

Create a new file called idList.json. Inside of that file will be a very small bit of JSON containing the idList value for your Trello board. This lets Trello know which board to use for creating your new card.

Justin Rohrman Justin has been a professional software tester in various capacities since 2005. In his current role, Justin is a consulting software tester and writer working with Excelon Development. Outside of work, he is currently serving on the Association For Software Testing Board of Directors as President helping to facilitate and develop various projects such as conferences, the WHOSE skill book, and BBST software testing courses.

Comments (1)