DEV Community

Cover image for The beginners guide to RESTful API
Emma Turner
Emma Turner

Posted on

2 1

The beginners guide to RESTful API

Today hundreds of companies use REST APIs to create web services. It's the most logical, efficient and widespread standard. So in this article we will take a deep look into it.


Overview

API

It stands for Application Programming Interface, a software intermediary that allows two apps to talk to each other.


Types by use Cases

APIs

It can be classified according to the systems for which they are designed.

Here are they :

  • Databases
  • Operating Systems
  • Remote
  • Web

What is it then?

RESTful API

It is an architectural style and approach to communications often used in web service development.

Architectural Constraints

There are 6 architectural constraints that make any web service. The only optional constraint is the last one:

  • Uniform Interface
  • Stateless -Cacheable
  • Client-Server
  • Layered System
  • Code on Demand (optional)

Why REST?

  • Client and server are separated
  • Visibility, readability and scalability
  • Independent of platforms and languages

How it works?

RESTful API uses existing HTTP method, providing a meaning for the request you're making, to obtain resources from the server:

  • GET - To retrieve a resource
  • PUT - To update a resource
  • POST - To create a new resource

Format

JSON - JavaScript Object Notation is a common format to send and request data through REST APIs. It's object looks like:

/* Each property and value must be wrapped with double quotation marks */
{
  "property1": "value1", 
  "property2": "value2", 
  "property3": "value3"
}
Enter fullscreen mode Exit fullscreen mode

Thanks For Reading

Previously at -> Emma's Blog

Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

Top comments (5)

Collapse
 
shafiemoji profile image
Shafi

I understand nothing, ABSOLUTELY NOTHING, by reading this.

Collapse
 
otumianempire profile image
Michael Otu

What do you think was the issue?

Collapse
 
shafiemoji profile image
Shafi • Edited

Very verbose and never getting to the point at all. This is meant to be a beginners guide to rest api, well I'm a beginner to rest, I didn't read na-da about rest here.

P.S. a lot of the sentences used in this seems like they are copy pasted from some documentation

Thread Thread
 
otumianempire profile image
Michael Otu

Assuming you have read on rest and you are comfortable with the concept, would you make any suggestions on improving this post?

Collapse
 
haducoder profile image
Steven Ha

she just put a bl here

SurveyJS custom survey software

JavaScript UI Library for Surveys and Forms

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

View demo

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay