Introduction:

  1. API
  2. An API is an Application Programming Interface. They are what gives the internet its tremendous power these days. They are like plug adaptors in that they allow different programs, codes, software and hardware to talk to each other, thus greatly enlarging the internet's power to transfer information. but how do we access APIs? We can use the Command Line Interface, and cURL.


  3. cURL
  4. The internet is not just what you se on your screen. Behind that screen lies many other things, and ways to obtain information. One of those is to use cURL from the CLI. We can acces information via cURL through web consoles or applications such as the Mac's Terminal. We can get web pages, structured data and information in JavaScript Object Notation format, or JSON. So, from Terminal we can use the command line as such:

    This will print out to the Terminal most of the code found at the Google home page:

    Google code from Terminal

    From here, we can direct this information into a file system, as such:

    Google code to index.html file from Terminal

    From here, should we be using things such as gitpod we can then visualise the contents. However, as things such as the CSS are not included, we will not get the formatting

    Google result from Terminal

    So, we can use cURL as a client for web pages.


    This is another client for web pages, accessed from the Terminal. We type the command links into Terminal and we are presented with:

    link browser from Terminal

    From here, we use the arrow keys to navigate and browse.

These are some of the many ways we can retrieve data from the web, especially APIs. Next, we'll see how to retireve and use JSON data.