SlideShare a Scribd company logo
2
Most read
3
Most read
8
Most read
REST API
Representational state transfer (REST)
Application programming interfaces – or APIs
• APIs represent a set of definitions and protocols.
• need them for app development and integration as they facilitate data
exchange between two pieces of software, like an information supplier (a
server) and a user.
• Programs use an API to communicate, retrieve information, or perform a
function.
• APIs allow users to work with the system to return their desired result.
• API acts as a mediator between users (clients) and resources (servers).
• defines a set of constraints to be used for creating web services.
What is REST?
• The REST stands for REpresentational State Transfer.
• State means data
• REpresentational means formats (such as XML, JSON, YAML, HTML,
etc)
• Transfer means carrying data between consumer and provider using
the HTTP protocol
A REST API (also called a RESTful API or RESTful web API) is an application programming interface (API)
A REST API (also called a RESTful API or RESTful web API) is an application programming interface (API)
Resource
The fundamental concept of a REST-based system is the resource. A
resource is anything you want to expose to the outside world,
through your application.
Example 1: Resources for Employee Management System:
- Employee
- Department
- Projects
- Task
- Address
Example 2: Resources for Student Management System:
- Student
- Teacher
- School
- Class
URI - Uniform Resource Identifier
• The resource can be identified by a Uniform Resource Identifier (URI). For
web-based systems, HTTP is the most commonly used protocol for
communicating with external systems. You can identify a unique resource
using a URI.
• Consider, we are developing a simple blog application and you can define URIs
for a blog Post resource:
• GET—http://localhost:8080/api/posts/: Returns a list of all posts
• GET—http://localhost:8080/api/posts/2: Returns a post whose ID is 2
• POST—http://localhost:8080/api/posts/: Creates a new Post resource
• PUT—http://localhost:8080/api/posts/2: Updates a POST resource whose ID is
2
• DELETE—http://localhost:8080/api/posts/2: Deletes a POST resource whose ID
is 2
A REST API (also called a RESTful API or RESTful web API) is an application programming interface (API)
REST Architecture
• Request and Response: Request is the input to a web service,
and the response is the output from a web service.
• Message Exchange Format: It is the format of the request and
response. There are two popular message exchange formats:
XML and JSON.
• Service Provider or Server: The service provider is one that
hosts the web service.
• Service Consumer or Client: A service consumer is one who is
using a web service.
A REST API (also called a RESTful API or RESTful web API) is an application programming interface (API)
REST Architectural Constraints
• Client-server architecture: The client is the front-end and the server is the back-end
of the service.
• Stateless: No data should be stored on the server during the processing of the
request transfer. The state of the session should be saved at the client’s end.
• Cacheable: The client should have the ability to store responses in a cache. This
greatly improves the performance of the API.
• Uniform Interface: This constraint indicates a generic interface to manage all the
interactions between the client and server in a unified way, which simplifies and
decouples the architecture.
• Layered System: The server can have multiple layers for implementation. This
layered architecture helps to improve scalability by enabling load balancing.
• Code on Demand: This constraint is optional. This constraint indicates that the
functionality of the client applications can be extended at runtime by allowing a
code download from the server and executing the code.
A REST API (also called a RESTful API or RESTful web API) is an application programming interface (API)
A REST API (also called a RESTful API or RESTful web API) is an application programming interface (API)
A REST API (also called a RESTful API or RESTful web API) is an application programming interface (API)
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpClient;
public class ExampleAPI
{
public static void main(String[] aa) throws IOException , InterruptedException
{
var url="https://text-translator2.p.rapidapi.com/translate";
var request=HttpRequest.newBuilder().GET().uri(URI.create(url)).build();
var client=HttpClient.newBuilder().build();
var response=client.send(request,HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
References
• https://rapidapi.com/collection/geocoding-location-apis
• https://www.javaguides.net/p/rest-api-tutorial.html
• https://www.javaguides.net/p/rest-api-tutorial.html

More Related Content

PPTX
Rest surekha
Surekha Achanta
 
PPTX
Unit 2
Ravi Kumar
 
PPTX
Research Topics in Machine Hypermedia
Michael Koster
 
PPTX
Introduction to APIs (Application Programming Interface)
Vibhawa Nirmal
 
PPTX
Java Web services
Sujit Kumar
 
PPTX
Mini-Training: Let's have a rest
Betclic Everest Group Tech Team
 
PPT
REST Introduction.ppt
KGSCSEPSGCT
 
Rest surekha
Surekha Achanta
 
Unit 2
Ravi Kumar
 
Research Topics in Machine Hypermedia
Michael Koster
 
Introduction to APIs (Application Programming Interface)
Vibhawa Nirmal
 
Java Web services
Sujit Kumar
 
Mini-Training: Let's have a rest
Betclic Everest Group Tech Team
 
REST Introduction.ppt
KGSCSEPSGCT
 

Similar to A REST API (also called a RESTful API or RESTful web API) is an application programming interface (API) (20)

PPTX
unit -4 spring web services like SOA Arch
sudharani127782
 
PPTX
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Jackson F. de A. Mafra
 
PPTX
REST & RESTful Web Services
Halil Burak Cetinkaya
 
PPTX
About HTTP and REST
Maggie Georgieva
 
PDF
Modern REST API design principles and rules.pdf
Aparna Sharma
 
PPTX
REST and RESTful Services
Damian T. Gordon
 
PPTX
Apitesting.pptx
NamanVerma88
 
PDF
REST - Representational State Transfer
Peter R. Egli
 
PDF
Rest API Automation with REST Assured
TO THE NEW Pvt. Ltd.
 
PPTX
web programming
shreeuva
 
PDF
ReSTful API Final
Claudine Bruyns
 
PPTX
Web Programming
VijayapriyaP1
 
PDF
REST - Representational state transfer
Tricode (part of Dept)
 
PPT
53 hui homework2
huis89
 
PPT
ROA.ppt
KGSCSEPSGCT
 
PPTX
Rest WebAPI with OData
Mahek Merchant
 
PPTX
REST API
Kanushka Gayan
 
PDF
REST API Recommendations
Jeelani Shaik
 
PPTX
A Deep Dive into RESTful API Design Part 1
VivekKrishna34
 
PDF
09-01-services-slides.pdf for educations
katariraju71
 
unit -4 spring web services like SOA Arch
sudharani127782
 
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Jackson F. de A. Mafra
 
REST & RESTful Web Services
Halil Burak Cetinkaya
 
About HTTP and REST
Maggie Georgieva
 
Modern REST API design principles and rules.pdf
Aparna Sharma
 
REST and RESTful Services
Damian T. Gordon
 
Apitesting.pptx
NamanVerma88
 
REST - Representational State Transfer
Peter R. Egli
 
Rest API Automation with REST Assured
TO THE NEW Pvt. Ltd.
 
web programming
shreeuva
 
ReSTful API Final
Claudine Bruyns
 
Web Programming
VijayapriyaP1
 
REST - Representational state transfer
Tricode (part of Dept)
 
53 hui homework2
huis89
 
ROA.ppt
KGSCSEPSGCT
 
Rest WebAPI with OData
Mahek Merchant
 
REST API
Kanushka Gayan
 
REST API Recommendations
Jeelani Shaik
 
A Deep Dive into RESTful API Design Part 1
VivekKrishna34
 
09-01-services-slides.pdf for educations
katariraju71
 
Ad

More from Kongu Engineering College, Perundurai, Erode (20)

PPTX
Event Handling -_GET _ POSTimplementation.pptx
Kongu Engineering College, Perundurai, Erode
 
PPTX
Introduction to Generative AI refers to a subset of artificial intelligence
Kongu Engineering College, Perundurai, Erode
 
PPTX
Introduction to Microsoft Power BI is a business analytics service
Kongu Engineering College, Perundurai, Erode
 
PPTX
Connect to NoSQL Database (MongoDB) using Node JS & Connect Node.js with NoSQ...
Kongu Engineering College, Perundurai, Erode
 
PPTX
concept of server-side JavaScript / JS Framework: NODEJS
Kongu Engineering College, Perundurai, Erode
 
PPTX
Node.js web-based Example :Run a local server in order to start using node.js...
Kongu Engineering College, Perundurai, Erode
 
PPT
Concepts of Satellite Communication and types and its applications
Kongu Engineering College, Perundurai, Erode
 
PPT
Concepts of Mobile Communication Wireless LANs, Bluetooth , HiperLAN
Kongu Engineering College, Perundurai, Erode
 
PPTX
Web Technology Introduction framework.pptx
Kongu Engineering College, Perundurai, Erode
 
PPTX
Computer Network - Unicast Routing Distance vector Link state vector
Kongu Engineering College, Perundurai, Erode
 
PPT
Android SQLite database oriented application development
Kongu Engineering College, Perundurai, Erode
 
PPT
Android Application Development Programming
Kongu Engineering College, Perundurai, Erode
 
PPTX
Introduction to Spring & Spring BootFramework
Kongu Engineering College, Perundurai, Erode
 
PPTX
SOA and Monolith Architecture - Micro Services.pptx
Kongu Engineering College, Perundurai, Erode
 
PPTX
Connect to NoSQL Database using Node JS.pptx
Kongu Engineering College, Perundurai, Erode
 
PPTX
Bootstarp installation.pptx
Kongu Engineering College, Perundurai, Erode
 
PPTX
nested_Object as Parameter & Recursion_Later_commamd.pptx
Kongu Engineering College, Perundurai, Erode
 
Event Handling -_GET _ POSTimplementation.pptx
Kongu Engineering College, Perundurai, Erode
 
Introduction to Generative AI refers to a subset of artificial intelligence
Kongu Engineering College, Perundurai, Erode
 
Introduction to Microsoft Power BI is a business analytics service
Kongu Engineering College, Perundurai, Erode
 
Connect to NoSQL Database (MongoDB) using Node JS & Connect Node.js with NoSQ...
Kongu Engineering College, Perundurai, Erode
 
concept of server-side JavaScript / JS Framework: NODEJS
Kongu Engineering College, Perundurai, Erode
 
Node.js web-based Example :Run a local server in order to start using node.js...
Kongu Engineering College, Perundurai, Erode
 
Concepts of Satellite Communication and types and its applications
Kongu Engineering College, Perundurai, Erode
 
Concepts of Mobile Communication Wireless LANs, Bluetooth , HiperLAN
Kongu Engineering College, Perundurai, Erode
 
Web Technology Introduction framework.pptx
Kongu Engineering College, Perundurai, Erode
 
Computer Network - Unicast Routing Distance vector Link state vector
Kongu Engineering College, Perundurai, Erode
 
Android SQLite database oriented application development
Kongu Engineering College, Perundurai, Erode
 
Android Application Development Programming
Kongu Engineering College, Perundurai, Erode
 
Introduction to Spring & Spring BootFramework
Kongu Engineering College, Perundurai, Erode
 
SOA and Monolith Architecture - Micro Services.pptx
Kongu Engineering College, Perundurai, Erode
 
Connect to NoSQL Database using Node JS.pptx
Kongu Engineering College, Perundurai, Erode
 
nested_Object as Parameter & Recursion_Later_commamd.pptx
Kongu Engineering College, Perundurai, Erode
 
Ad

Recently uploaded (20)

PPTX
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
PDF
July 2025: Top 10 Read Articles Advanced Information Technology
ijait
 
PPTX
Civil Engineering Practices_BY Sh.JP Mishra 23.09.pptx
bineetmishra1990
 
PDF
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
PDF
settlement FOR FOUNDATION ENGINEERS.pdf
Endalkazene
 
PPTX
FUNDAMENTALS OF ELECTRIC VEHICLES UNIT-1
MikkiliSuresh
 
PPT
SCOPE_~1- technology of green house and poyhouse
bala464780
 
PPTX
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
PPTX
Chapter_Seven_Construction_Reliability_Elective_III_Msc CM
SubashKumarBhattarai
 
PPTX
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
PPTX
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
PDF
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
PDF
2025 Laurence Sigler - Advancing Decision Support. Content Management Ecommer...
Francisco Javier Mora Serrano
 
PDF
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
PDF
Software Testing Tools - names and explanation
shruti533256
 
PDF
Unit I Part II.pdf : Security Fundamentals
Dr. Madhuri Jawale
 
PPT
Ppt for engineering students application on field effect
lakshmi.ec
 
PDF
dse_final_merit_2025_26 gtgfffffcjjjuuyy
rushabhjain127
 
PDF
FLEX-LNG-Company-Presentation-Nov-2017.pdf
jbloggzs
 
PDF
Zero carbon Building Design Guidelines V4
BassemOsman1
 
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
July 2025: Top 10 Read Articles Advanced Information Technology
ijait
 
Civil Engineering Practices_BY Sh.JP Mishra 23.09.pptx
bineetmishra1990
 
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
settlement FOR FOUNDATION ENGINEERS.pdf
Endalkazene
 
FUNDAMENTALS OF ELECTRIC VEHICLES UNIT-1
MikkiliSuresh
 
SCOPE_~1- technology of green house and poyhouse
bala464780
 
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
Chapter_Seven_Construction_Reliability_Elective_III_Msc CM
SubashKumarBhattarai
 
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
2025 Laurence Sigler - Advancing Decision Support. Content Management Ecommer...
Francisco Javier Mora Serrano
 
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
Software Testing Tools - names and explanation
shruti533256
 
Unit I Part II.pdf : Security Fundamentals
Dr. Madhuri Jawale
 
Ppt for engineering students application on field effect
lakshmi.ec
 
dse_final_merit_2025_26 gtgfffffcjjjuuyy
rushabhjain127
 
FLEX-LNG-Company-Presentation-Nov-2017.pdf
jbloggzs
 
Zero carbon Building Design Guidelines V4
BassemOsman1
 

A REST API (also called a RESTful API or RESTful web API) is an application programming interface (API)

  • 2. Application programming interfaces – or APIs • APIs represent a set of definitions and protocols. • need them for app development and integration as they facilitate data exchange between two pieces of software, like an information supplier (a server) and a user. • Programs use an API to communicate, retrieve information, or perform a function. • APIs allow users to work with the system to return their desired result. • API acts as a mediator between users (clients) and resources (servers). • defines a set of constraints to be used for creating web services.
  • 3. What is REST? • The REST stands for REpresentational State Transfer. • State means data • REpresentational means formats (such as XML, JSON, YAML, HTML, etc) • Transfer means carrying data between consumer and provider using the HTTP protocol
  • 6. Resource The fundamental concept of a REST-based system is the resource. A resource is anything you want to expose to the outside world, through your application. Example 1: Resources for Employee Management System: - Employee - Department - Projects - Task - Address Example 2: Resources for Student Management System: - Student - Teacher - School - Class
  • 7. URI - Uniform Resource Identifier • The resource can be identified by a Uniform Resource Identifier (URI). For web-based systems, HTTP is the most commonly used protocol for communicating with external systems. You can identify a unique resource using a URI. • Consider, we are developing a simple blog application and you can define URIs for a blog Post resource: • GET—http://localhost:8080/api/posts/: Returns a list of all posts • GET—http://localhost:8080/api/posts/2: Returns a post whose ID is 2 • POST—http://localhost:8080/api/posts/: Creates a new Post resource • PUT—http://localhost:8080/api/posts/2: Updates a POST resource whose ID is 2 • DELETE—http://localhost:8080/api/posts/2: Deletes a POST resource whose ID is 2
  • 9. REST Architecture • Request and Response: Request is the input to a web service, and the response is the output from a web service. • Message Exchange Format: It is the format of the request and response. There are two popular message exchange formats: XML and JSON. • Service Provider or Server: The service provider is one that hosts the web service. • Service Consumer or Client: A service consumer is one who is using a web service.
  • 11. REST Architectural Constraints • Client-server architecture: The client is the front-end and the server is the back-end of the service. • Stateless: No data should be stored on the server during the processing of the request transfer. The state of the session should be saved at the client’s end. • Cacheable: The client should have the ability to store responses in a cache. This greatly improves the performance of the API. • Uniform Interface: This constraint indicates a generic interface to manage all the interactions between the client and server in a unified way, which simplifies and decouples the architecture. • Layered System: The server can have multiple layers for implementation. This layered architecture helps to improve scalability by enabling load balancing. • Code on Demand: This constraint is optional. This constraint indicates that the functionality of the client applications can be extended at runtime by allowing a code download from the server and executing the code.
  • 15. import java.io.IOException; import java.net.URI; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.http.HttpClient; public class ExampleAPI { public static void main(String[] aa) throws IOException , InterruptedException { var url="https://text-translator2.p.rapidapi.com/translate"; var request=HttpRequest.newBuilder().GET().uri(URI.create(url)).build(); var client=HttpClient.newBuilder().build(); var response=client.send(request,HttpResponse.BodyHandlers.ofString()); System.out.println(response.statusCode()); System.out.println(response.body()); } }