Part 4.2Application Programming Interfaces

When computers first started, developers thought it might be a good idea to make code reusable not just within their own program but out with the program itself. Today these programs are used within other programs to make them more functional.

For example, the Windows kernel is closed source and often cannot be accessed directly to perform operations. However, the win32 DLL file provides an interface that allows programmers to access, or communicate with, parts of the kernel and can be accessed with many different programming languages.

What is an API?

An API or Application Programming Interface is a method of development which involves creating an interface that other items must implement. Put simply, it's like a blueprint.

By knowing how the information needs to be sent and will be received when it is requested, it is possible to develop an application to interact with it.

REST APIs

The web moved on to using web APIs around about 2011 and since then it has become a very big element of developing web apps. A REST API (or Representational State Transfer API) is one which uses web technologies to provide an application with data. The data would be transmitted in a data format such as JSON, HTML, XML or SOAP.

REST APIs became a big thing because of their simplicities including the ability to be cross-platform. For example, ZPE uses REST to communicate back and forth with the webserver when storing and retrieving data from ZPE Online. This normally takes away the pain of communicating with different programming languages that normal software APIs have.

The data that is passed back to the application through this interface is often stored in a database and compiled to the chosen format very quickly.

REST APIs often use the HTTP specifications GET, PUT and POST commands to specify what they want to do. For example, if the application needed to add new data on to the webserver database it would likely use a POST or a PUT command whereas if it wanted to retrieve data it would use a GET command.

For example:

https://zpe.jamiebalfour.scot/zule/?command=list

This is the API for the ZULE repository. It is used to list all available files on the ZULE package manager. The question mark section of the URL indicates a GET request to the API. Semantically, this means that the application is requesting and not sending data.

Code preview
Feedback 👍
Comments are sent via email to me.