Team Howard Rest Api

From Coder Merlin
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder


REST API, illustrated


An API, or application programming interface, is a set of rules that define how applications or devices can connect to and communicate with each other. Essentially, it is a connection between computers or programs. The API is the mediator between your input and the information that the program gives you.

An example of an API is a travel website. You can go to a travel helper website to search for hotels and transportation in a specific location for a specific price; The website looks at the criteria and information you supplied it and searches other sites to give you comprehensive information from a variety of sources. The website doesn’t edit or add to the databases it checks, it simply reads them and displays the relevant information to you, the user. This is similar to the function of an API: it seeks for information suiting the criteria and information you give it, and gathers the necessary information from other databases in order to display it for you.

REST and REST API[edit]

Representational state transfer (REST) is a software architectural style that was created to guide the design and development of the architecture for the World Wide Web. REST defines a set of constraints for how the architecture of a system, such as the Web, should behave.

HTTP requests are made by users or clients, to a named host, which is located on a server. The aim of the request is to access a resource on the server. To make the request, the client uses components of a URL, which includes the information needed to access the resource.

So, utilizing this information together, a REST API is an API that conforms to the design principles of the REST, or representational state transfer architectural style. They are also referred to as RESTful APIs.

The CRUD acronym

They use HTTP requests to communicate, access, and use data. That data can be utilized for creating, reading, updating, and deleting records. Specifically, the data acquired through a request can be used to utilize GET, PUT, POST and DELETE data types, which refers to the reading, updating, creating and deleting of operations concerning resources (also known as the acronym CRUD).

REST APIs can be developed using virtually any programming language and support a variety of data formats. The only restriction is that they must adhere to the six REST design principles, which are outlined in the following section.

Going DeeperGoingDeeperIcon.png
Examples of a real-life REST API usage
  • An API request on a facebook page that finds the total number of likes on its posts
  • An API request on Google Maps that finds the geographical coordinates of a certain location
  • An API request on Instagram to find photos posted in a specific location

Important factors in a REST API[edit]

Uniform interface:[edit]

There should solely be one way for the REST API to request the same information; If the REST API is looking for the same information more than once, the request should be the same every time the information is requested. Additionally, every time the REST API finds or receives information, it should encompass all the needed information without being overwhelmingly large.

Client-server decoupling:[edit]

A key factor in a REST API is that the client and server applications must be independent. The client should only know about the URI (a combination of a URL and a URN, or Universal Resource Name) requested, not the server's applications. Vice versa, the server application should not change the client application, it should simply pass the data via a HTTP link.


In a REST API, the server should store no state about the client session on the side of the server. Any unnecessary management of states should take place on the side of the client, not the server. This factor essentially creates a situation where calls are able to be made independent of each other.


Server responses need to contain information on whether caching is allowed for the specific resource. The goal of this requirement is to improve performance on the client side, while increasing scalability on the server side. Essentially, cached data towards a client will streamlining the process of the API, making its functions smoother and faster.

Layered system architecture:[edit]

REST API has a system made up of different layers through which calls and responses are transported. This style is designed to constrain behavior of different components to ensure that they can only see the specific layer that they are interacting with at that moment. The client nor the server should be able to tell if they are interacting with themselves or a layer in between them.

Code on demand:[edit]

Finally, REST extends functionality by downloading and executing code in the form of an applet, a small application that performs one specific task that runs within a larger program, and scripts, which are series of instructions that is interpreted and carried out by another program.