- March 25, 2015

The venerable cURL command-line tool to interact with URLs throughout various protocols just turned 17 last week. Daniel Stenberg, the creator of cURL, is still to this day the leader of the project, showing an amazing track record, and gives an interesting overview of the cURL story on his blog. Daniel started cURL when Open Source wasn’t really a thing just yet — the term OSS was actually coined the same year, in 1998, when the project was created. Over those 17 years, 1200 persons contributed to the project!

On behalf of the Restlet team, we wish cURL a very happy birthday, and congratulate Daniel for this achievement!


To further celebrate this anniversary, let’s use cURL to invoke APISpark hosted APIs!

If you follow one of our tutorials on creating your first API from scratch, exposing a SQL database or a Google Spreadsheet in a web API, you’ll want to test your API: once it is published, you can invoke your web API with cURL.

You’ll need to take note of your API endpoint URL, and the Basic Auth credentials, that you can find in the Overview tab, under the Endpoints section, as you can see in the screenshot below. We’re going to pass them to cURL via the command line.


So for instance, if you have a simple “car” resource in your API, you’ll be able to list all the available cars with:

curl --user 
     -H "Accept: application/json" 
     -X GET

If there’s no car yet in your garage data store, cURL will return an object with an empty list:


Let’s add a new car to the list, with the following command:

curl --user 
     -H "Content-Type: application/json"
     -X POST 
     -d '{"name": "Tesla"}'

The APISpark server will reply with the details of the created resource:


And if you make another GET call on the collection endpoint, you will see it being returned in the list:


Next, you might be deciding to sell your Tesla car? So let’s remove it from the garage:

curl --user 
     -H "Accept: application/json" 
     -X DELETE

Your garage is now empty, thanks to cURL and Daniel Stenberg, time to shop for your new car!