What is REST and how is it used in a API?

Table of Contents

This post is a high-level overview of the REST protocol used in many APIs.

What is REST?

Representation State Transfer (REST), as defined by Wikipedia, is the software architectural style of the World Wide Web that uses a coordinated set of constraints, applied to the design of components in a distributed hypermedia system, which can lead to a higher-performing and more maintainable software architecture.

In short, REST or RESTful API is the web standard that was created to make HTTP requests easier and more powerful.

What Makes REST So Great?

Before the REST architecture became a standard in the development community other Web Services were used to pass data between machines.  These Web Services, such as RPC and SOAP, are still widely used, but more and more developers have taken up the REST architecture to make things simpler and easy to maintain.

This simple interface makes using REST a breeze, which in turn helps developers to create applications that leverage APIs in a shorter period of time.  The core WordPress team knew this and decided that the WordPress API should be a RESTful API :)

Using Default HTTP Request Verbs

Within every single HTTP request there can be a verb that determines the action of that request. REST uses the four main HTTP Requests verbs:

  • GET
  • POST
  • PUT
  • DELETE

These four verbs are used with every REST API call and are used to determine the action of the request.  For example, if you call an API endpoint /users/1 with a GET action then the API might return a user with the ID of 1. On the other hand, if you send the exact same request to the same endpoint with the DELETE action then it might delete the user with the ID of 1. As you can see a RESTful API can perform two completely different functions based solely on the HTTP Request verb specified.

This is where the power of using HTTP verbs can be shown because you are able to perform 4 actions per endpoint instead of having to change endpoints for each different action.  Overall this makes understanding RESTful APIs much easier.

Where is it Used?

Most APIs that function via HTTP Requests use this RESTful architecture.  It is very easy for developers to follow and understand how the API works, and notable companies that use this RESTful architecture are:

  • Twitter
  • Facebook
  • LinkedIn
  • Google
  • WordPress :)
  • and many more

With the RESTful architecture APIs are more maintainable, scalable, and easier to user for internal and external developers.  Continue reading our next post about the WordPress API and what it means to the WordPress community.

Share with your Friends!
Facebook
Twitter
Pinterest
LinkedIn
Keep up with Us!
Be the first to read our next post
This field is for validation purposes and should be left unchanged.

Divider

Popular Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

You give us just an email. We'll give you the latest Nuts & Bolts on online marketing, PPC advertising, SEO, & web development.

This field is for validation purposes and should be left unchanged.

Discover how we can help your business grow

We’ll get back to you within a day to schedule a quick strategy call. We can also communicate over email if that’s easier for you.

"*" indicates required fields

This field is for validation purposes and should be left unchanged.