0% found this document useful (0 votes)
75 views11 pages

REST API Fundamentals Explained

REST API fundamentals including: - API allows interaction between systems by following standards and protocols to share features and data. - REST uses HTTP and transfers data through GET, POST, PUT, DELETE and PATCH methods. - Key components of a REST API request include the URL, URI, parameters, headers and HTTP status codes returned.

Uploaded by

Keshav Gautam
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views11 pages

REST API Fundamentals Explained

REST API fundamentals including: - API allows interaction between systems by following standards and protocols to share features and data. - REST uses HTTP and transfers data through GET, POST, PUT, DELETE and PATCH methods. - Key components of a REST API request include the URL, URI, parameters, headers and HTTP status codes returned.

Uploaded by

Keshav Gautam
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
  • Introduction to REST API
  • API Concept
  • API as Interface
  • Architecture of REST API
  • Request Anatomy: URL
  • Uniform Resource Identifier
  • Body Parameters
  • Parameters in API Requests
  • Request Headers
  • REST API Methods
  • HTTP Status Codes

brijpandeyji

Rest API
Fundamentals

All that you

need to know!

swipe
brijpandeyji

API Concept

API allows interactions between


systems by following a set of
standards and protocols in order
to share features, information
and data.

Full form of API

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.

Uses HTTP protocol


as a communication
interface.
It transfers data
through HTTP
methods.
Diagram

Client REST API Database

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.

In an API, the URL can be named as


Base URL, which means that is the
base address that will be used in
every request.
Example : [Link]

swipe
brijpandeyji

URI
Uniform Resource Identifier

It is used in the URL to specify


which resource the client would
like to access in a request.
Example : [Link]
name=laptop&available=true
URI
Here, the client (highlighted in purple)
communicates to the
server that the request is
to retrieve products with
name equals laptop, and
available equals true.
Every URL is an URI, but not all URIs are URLs.
swipe
brijpandeyji

Body Params
Body of the request which contains
all the data that the server needs to
successfully process the request.

Only used in requests that must send


information, such as create or update.
Example

“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.
[Link]
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.
[Link]
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

Authorization : Bearer token

Accept : application/json

In this given example, the client


is sending extra data informing
not just it’s credentials to access
a resource, but also a desired
response format
format..
brijpandeyji

REST API Methods


5 Methods
1 GET
Receive information about
an API resource.

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

Http Status Codes

With every request


made to the server, we
get response code /http
status codes in return.
Status Codes

2XX : Success

3XX : Redirection

4XX : Problem with the client

5XX : Problem with the server

swipe

brijpandeyji
swipe
Rest API
Fundamentals
All that you
need to know!
brijpandeyji
swipe
API Concept
Application 
Programming 
Interface
A -
P -
I  -
API
protocols
features information
data
 allo
brijpandeyji
swipe
API
API acts as an 
interface between 
different 
applications.
Diagram
brijpandeyji
swipe
REST API
It is an 
 to develop web 
applications.
architecture 
style
Uses 
as a communication 
interface.
brijpandeyji
swipe
Request Anatomy
URL
Uniform Resource Locator
It is the 
 to not just 
identify a resource, but also to 
sp
brijpandeyji
swipe
URI
It is used in the 
 to specify 
which resource the 
 would 
like to access in a 
.
URL
client
request
brijpandeyji
swipe
Body Params
Body of the 
 which contains 
all the data that the 
 needs to 
successfully process the reque
brijpandeyji
swipe
Parameters
Types
Types
Types
Information
sent
 that can be 
 in a request by the 
client in order to influ
brijpandeyji
Headers
It allows sending extra 
information in a request, 
such as 
 
and 
.
authentication tokens
content type
brijpandeyji
swipe
REST API Methods
1
GET
Receive information about 
an API resource.
5 Methods
2
3
4
5
POST
PUT
DELETE
PATCH

You might also like