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"
}
Thanks For Reading