REST API

Development
REST API thumbnail

What is a REST API?

Definition:

A REST (REpresentational State Transfer) API, or RESTful API, is an application programming interface (API or Web API) that conforms to the constraints of REST architectural style and allows for interaction with RESTful web services.

Analogy:

A REST API is the way your waiter writes down your order.

A waiter can record your order in many different ways. Maybe the try to memorize all of the orders and don't write anything down. Maybe they have a blank pad of paper, or pre-organized pad of all menu items. Maybe, they just use an iPad.

Depending on the restaurant and the responsibilities of the waiter, they may choose a specific way to take your order to most effectively facilitate the transfer of information.

In other words...

A REST API is a style of API that dictates how you can access and use data.

Why is a REST API important?

It's one thing to know what a term means, but that is worthless if you don't know why you should know what a REST API is in the first place. Let's break down the importance of this tech term based on two high level categories. We'll walk through an explanation as well as provide a score, 1-10, that shows you how much you should care about REST APIs.

Pre-Product: 4/10

The first will be if you do not have a product yet. This means that you don't have a physical product. Maybe you're in the ideation phase, or maybe you're almost ready to start development. Whichever it is, we'll get into why a REST API is important and why you should or shouldn't care about it if you do not have a product.

As a founder, a REST API is not too relevant if you don't have a product yet. You should learn about the functionality of an API, but the actual type of APIs is more relevant once you actually have a product and need to understand how your site should function most effectively.

Live Product: 5/10

The second category is if you do have a live product. Maybe you just launched your business or maybe it's been live for years and you're continuing to improve its quality. Regardless of the scenario, if your product is live, REST APIs carry a different weight.

As a founder, a REST API is fairly relevant if you are working within your codebase. It is very relevant if you are a developer, so you as the founder need to make sure you understand why your team is choosing to use a REST API.

Examples of a REST API

So you know what a REST API is, by definition. You know if you should care about it or not depending on your situation as a business/company/product. To dig in deeper, we will walk through some examples so we can make sure you really have a solid grasp on REST APIs.

Five essential methods of REST:

Remember, a REST API is a way of going about organizing and executing your API. There are 5 essential methods in RESTful API development - we'll walk through all of them below.

  1. POST

    A POST method is used when you want to send a bulk amount of data to a server from a specified resource. POST requests are commonly used to submit web forms or upload files. In doing so, it is important that the server receiving this information is able to capture it in the same format.
  2. PUT

    A PUT method will place a file, attachment, or resource at a specific URL, putting it exactly where it should go. If there is no listed URL as to where the file or resource should go, then the PUT method will create a custom URL for the action. This will allow you to create a new resource or overwrite existing ones if you want to send items to the same address as a previous PUT.
  3. PATCH

    A PATCH method is when an API requests that a set of changes, as described in the request, be performed and applied to the specific resource identified. In other words, you are patching an operation with a new command, targeting a specific destination.
  4. GET

    A GET method, as its name alludes it, is when you want to receive information. You can utilize a GET method when you want to retrieve certain information and nothing more. You won't alter the information by adding or deleting any aspect of it, you will be getting it just as it is.
  5. DELETE

    A DELETE method is probably the most self-explanatory method; it is used when you want to delete a specific resource. This command is performed to permanently remove information. Once performed, it can only be executed once as the information can only be deleted one time.

Key Takeaways:

  1. A REST API is a style of API that dictates how you can access and use data.
  2. If you don't have a product yet, you should start to get acquainted with the methods of API so you are prepared once you start development.
  3. If you do have a product, be aware if you are using any REST APIs.
  4. There are five common REST API methods: POST, PUT, PATCH, GET, & DELETE.
Not seeing a term? 🤔