Rest API
Rest API
Rest API
Fundamentals
need to know!
swipe
brijpandeyji
API Concept
A - Application
P - Programming
I - Interface
swipe
brijpandeyji
API acts as an
interface between
different Diagram
applications.
API
swipe
brijpandeyji
REST API
REST
Representational It is an architecture
State Transfer
style to develop web
applications.
swipe
brijpandeyji
Request Anatomy
URL
Uniform Resource Locator
It is the address to not just
identify a resource, but also to
specify how to access it.
swipe
brijpandeyji
URI
Uniform Resource Identifier
Body Params
Body of the request which contains
all the data that the server needs to
successfully process the request.
“name” : “Laptop”
“price” : 1000
“available” : true
swipe
brijpandeyji
Parameters
Information that can be
sent in a request by the
client in order to influence
the response by the server.
Types
Path Parameter
A variable in the URI path that
helps in pointing towards
specific resource.
https://food.com/restaurant/1/total-orders
1 is the path parameter (variable) which points to
restaurant no 1’s total orders.
Query Parameter
A variable in URI path that helps in
querying / filtering through a list of
resources.
https://food.com/products?name=cake
name=cake is the query parameter (variable)
which retrieves products with the name “cake”.
swipe
brijpandeyji
Headers
It allows sending extra
information in a request,
such as authentication tokens
and content types.
Example
Accept : application/json
2 POST
Create an API resource
3 PUT
Update an API resource
4 DELETE
Delete an API resource
5 PATCH
Modifies an API resource
swipe
brijpandeyji
2XX : Success
3XX : Redirection
swipe