DEV Community

loading...
Cover image for The beginners guide to RESTful API

The beginners guide to RESTful API

Emma Turner
Front-end Developer and Blogger
・1 min read

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

Discussion (5)

Collapse
shafiemoji profile image
Shafi

I understand nothing, ABSOLUTELY NOTHING, by reading this.

Collapse
otumianempire profile image
Otu Michael

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
Otu Michael

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