API: is way for two computers communicating each other
REST= Representational State Transfer
:Loose set of rules that has been the common standard building web API.
An API that follows the REST standard called RESTful API
- Organise resources into a set of unique URIs(uniform resource identifier)
- The URIs differentiate different types of resources on a server
- HTTP verb which tells the server what we want to do with the resource
- POST(create), GET(read), PUT(Update), DELETE(remove)
- body is where payload of data is stored usually encoded in JSON
- stateless: no need to store any info about each other, every req & res is independent from all others.>> easy to scale and well-behaved.
- versioning: allow breaking changes from one version to another>> providing backward compatibility
The resources should be grouped by noun
The client interact with a resource by making a res to the end point for the resource over HTTP. The req has a very specific format.
Req status
200 level (success)
400 level (something wrong with our request)
500 level (something wrong at the server level)
Idemponent: making multiple identical requests has the same effect as making a single request (not case for POST)
Cacheable/Performance
- Lightweight. One of the main benefits of REST APIs is that they rely on the HTTP standard, which means it's format-agonistic and you can use XML, JSON, HTML, etc. ...
- Independent. Another benefit of REST APIs is the fact that the client and server are independent. ...
- Scalable and flexible.
What makes service RESTful?
A RESTful service is a type of web service that follows the principles of Representational State Transfer (REST). Here are some of the characteristics that make a service RESTful:
- Client-server architecture: The client and server are separate and independent components that communicate through a stateless protocol.
- Statelessness: Each request from the client to the server contains all the necessary information to complete the request. The server doesn't store any client state between requests.
- Uniform interface: The interface between the client and server is standardized, which means that the client and server can be developed independently.
- Resource-based: RESTful services are resource-based, meaning that the server represents the state of the resource to the client.
- Cacheability: Responses from the server can be cached on the client or intermediaries.
- Layered architecture: Intermediaries can be used to improve scalability, performance, and security.
By following these principles, a service can be considered RESTful, which can provide benefits such as simplicity, scalability, and flexibility.
Why RESTful? Benefits?
Response Code?
You have an end point of a brute force attack (1000 of attempts of attack)>> how to mitigate the attack
If req is sent from Postman/command promt/web, how can you insure the req is from web not from Postman..?
What would be your matric to say if this is good or bad code
Junior/Intermediate/Seniour responsibilites
PM wants to get some feature to be done, what matrix that transforms your business logic to working coordination.