ITNEXT

ITNEXT is a platform for IT developers & software engineers to share knowledge, connect, collaborate, learn and experience next-gen technologies.

Follow publication

Explore REST APIs with cURL

Clueless about working with Web Services?

Erik Engheim
ITNEXT
Published in
7 min readOct 18, 2020

--

Photo by Jordan Harrison on Unsplash

Nothing makes me feel more like fish out of water than working with web technologies. This this is an overview as much for your benefit as for my own about how to work with REST APIs primarily using the cURL Unix command. I will also look at how you can do this from some different programming languages.

Read more:

To avoid that you have to jump around all over the place, I will try to put all the key information right in this article.

What is a REST API?

It is not like a programming API when you are using C/C++, Python etc. Rather it is an API exposed as a set of URLs. That means you could actually interact with a REST API using nothing but your Web browser. REST is just a simple way of interacting with an application running on a server using Web technology such as the HTTP protocol.

You do this primarily by using one of two HTTP requests:

  • GET This is what happens when you write a URL in your web browser. A GET request is sent to the web sever and some data is returned, usually a web page in HTML which your web browser shows.
  • POST Is used to send data. It also involves specifying a URL but this also involves supplying some data to send.

By request I mean that you send some data to a server over your TCP/IP connection with the intention on getting some specific data back.

You could e.g. visit my home page by writing the URL address http://blog.translusion.com in your web browser, or you could use the Unix curl command to download the HTML page:

$ curl http://blog.translusion.com

If you add the -i switch as well you will also get the HTTP header which looks something like this:

--

--

Published in ITNEXT

ITNEXT is a platform for IT developers & software engineers to share knowledge, connect, collaborate, learn and experience next-gen technologies.

Written by Erik Engheim

Geek dad, living in Oslo, Norway with passion for UX, Julia programming, science, teaching, reading and writing.

No responses yet

Write a response