SlideShare a Scribd company logo
REST API
By Devi Kiran
KickStartPros.com
contact@kickstartpros.com
• JSON1
• REST API2
• JS libs and Play3
Agenda
JSON
• JSON = JavaScript Object Notation
• Lightweight data interchange format
• Organization with Employees
REST API & DESIGN
What is REST?
• REST = REpresentational State Transfer
• Architectural Constraints
– Client-Server
– Uniform Interface
– Stateless
– Cacheable
– Layered System
– Code on demand
REST - Resource Based
REST
• Nouns, Not Verbs
• Things are identified by
URIs
• Person, User, Address
resource
• HTTP Verb to dictate the
operation on that resource.
• Multiple URIs pointing to
same resource.
SOAP - RPC
• Verbs or Actions.
• RPC calls (Don’t do this in
REST)
– getUserData
– getAllUsers
– searchUsers
– getUserAddress
– updateUserAddress
– deleteUser
Representations
• Represent part of the
resource state.
• JSON or XML
• Example: Buy a car
– Resource: Car (Audi A1)
– Service: Buy (POST)
– Representation:
• Name, Model, Price
• JSON or XML format.
REST API Design
Different REST Clients
iPhone App
Browser/
Web
Android App DELETE
PUT
GET
POST
CUSTOM
Params
Http
Methods
Your App Server
Load balanced
App
Server 1
App
Server
App
Server
App
Server
1…n
KickStartPros.com
Http/s
JSON/XML
JSON/XML
JSON/XML
HTTP Methods & Status Codes
• GET
• HEAD
• POST
• PUT
• DELETE
• TRACE
• OPTIONS
• 2xx Success
– 200 Ok
– 204 No Content
• 3xx Redirect
– 304 Not Modified
• 4xx Client Error
– 400 Bad Request
– 401 Unauthorized
– 403 Forbidden
– 404 Not Found
• 5xx Server Error
– 500 Internal Server Error
Keep Http/s Simple
• Resources – URI format
– Collection Resources (/users)
– Instance Resources (/users/ayl23d)
• Behavior
– Use Http Methods => CURD Database/Server Actions
– POST => Create
– GET => Read
– PUT => Update
– DELETE => Delete
– HEAD => Headers, no body
• Media types
– application/json
– application/xml
Post for Create
POST /users
{
“name” : “Kiran”
}
Response:
201 Created
Location:
http://www.kickstartpros.com/users/gdk23
Put for Update
PUT /users/<userId>
PUT /users/gdk23
{
“name” : “Devi Kiran”
“description”: “Trainer”
}
Post for Update
POST /users/<userId>
POST /users/gdk23
{
“name”: “Devi Kiran”
}
(Partial update or Full update)
Response:
200 OK
ARCHITECTURAL
CONSTRAINTS
Client and Server
• Uniform Interface Decouples Client and
Server
• Design – http and URIs
– HTTP verbs (GET, PUT, POST, DELETE)
– URIs
– HTTP response
• Status
• Body
Uniform interface
• The uniform interface decouples client and
Server
– Identification of resources
– Manipulation of resources through these
representations
– Self-descriptive messages
HATEOAS
• Hypermedia as the engine of application state
• Client to Server
– Body Content
– URI and Query String parameters
– Request Headers
• Server
– Body Content
– Response Codes
– Response Headers
Stateless
• No client state at server.
• Any State is maintained
at Client side.
• Each request has all the
information to process
the request.
Client
1
Client
2
Client
3
Servers
More …
• Layered System
– A client cannot tell
whether it is connected
directly to the server.
– Load balanced Servers
– More Performance
• Cacheable
– Implicit
– Explicit
REST APIS & PLAY
Example URIs
• GMail Rest API (v1 Reference by resource
type)
• Custom REST API from Yahoo
– https://developer.yahoo.com/yql/console/
– Example: get san francisco geo data:
select * from geo.places where text=“san francisco,
ca”
UI Data binding of REST API
• JQuery – Ajax calls
• Data Binding JS libs that help to bind with REST
response
– JQuery UI – Widgets
– Knockout – Model-View-ViewModel (MVVM)
– Angular JS – MVVM & MVC
– Backbone.js – RESTful JSON interface
– Ember.js – Template language, MVC and a router
– Kendo UI – MVVM
– Extjs – MVC (Model View Controller) & widgets
Summary & Reference
• JSON & REST Architecture
• Resource based REST API = Micro Services (SOA)
• REST API & Examples with JS libs
• Reference – Wiki
• contact@kickstartpros.com
– Join our trainings.
– Kick Start your project with us.

More Related Content

What's hot (20)

PPTX
Introduction To DevOps | Devops Tutorial For Beginners | DevOps Training For ...
Simplilearn
 
PPTX
What is an API Gateway?
LunchBadger
 
PPTX
Angular 4 and TypeScript
Ahmed El-Kady
 
PPTX
Introduction to graphQL
Muhilvarnan V
 
PDF
Introduction to GraphQL
Sangeeta Ashrit
 
PDF
GraphQL
Joel Corrêa
 
PDF
Introduction to Spring Cloud
VMware Tanzu
 
PPTX
Solid principles
Monica Rodrigues
 
PDF
GraphQL: Enabling a new generation of API developer tools
Sashko Stubailo
 
PPTX
An intro to GraphQL
valuebound
 
ODP
Web service Introduction
Madhukar Kumar
 
PDF
RPC에서 REST까지 간단한 개념소개
Wonchang Song
 
PDF
Patterns of evolution from monolith to microservices
Karina Mora
 
PPTX
React js - The Core Concepts
Divyang Bhambhani
 
PPTX
02 api gateway
Janani Velmurugan
 
ODP
Introduction to Swagger
Knoldus Inc.
 
PDF
Angular - Chapter 5 - Directives
WebStackAcademy
 
PPTX
Introduction to GraphQL
Rodrigo Prates
 
PPTX
RESTful API - Best Practices
Tricode (part of Dept)
 
PDF
REST vs GraphQL
Squareboat
 
Introduction To DevOps | Devops Tutorial For Beginners | DevOps Training For ...
Simplilearn
 
What is an API Gateway?
LunchBadger
 
Angular 4 and TypeScript
Ahmed El-Kady
 
Introduction to graphQL
Muhilvarnan V
 
Introduction to GraphQL
Sangeeta Ashrit
 
GraphQL
Joel Corrêa
 
Introduction to Spring Cloud
VMware Tanzu
 
Solid principles
Monica Rodrigues
 
GraphQL: Enabling a new generation of API developer tools
Sashko Stubailo
 
An intro to GraphQL
valuebound
 
Web service Introduction
Madhukar Kumar
 
RPC에서 REST까지 간단한 개념소개
Wonchang Song
 
Patterns of evolution from monolith to microservices
Karina Mora
 
React js - The Core Concepts
Divyang Bhambhani
 
02 api gateway
Janani Velmurugan
 
Introduction to Swagger
Knoldus Inc.
 
Angular - Chapter 5 - Directives
WebStackAcademy
 
Introduction to GraphQL
Rodrigo Prates
 
RESTful API - Best Practices
Tricode (part of Dept)
 
REST vs GraphQL
Squareboat
 

Viewers also liked (19)

PDF
Rest api design by george reese
buildacloud
 
PDF
Final Master's Defense Presentation : Policy-driven Security Management in Ga...
Clinton DSouza
 
PPTX
REST in short
Akshay Ballarpure
 
PDF
Introduction to REST API with Node.js
Yoann Gotthilf
 
PDF
Laravel Restful API and AngularJS
Blake Newman
 
PDF
How to connect AngularJS to servers
Carlos Morales
 
PDF
Angularjs & REST
Corley S.r.l.
 
PDF
How to Release Rock-solid RESTful APIs and Ice the Testing BackBlob
Bob Binder
 
PPTX
Datasnap avançado - Respostas para um sistema robusto - Embarcadero Conferenc...
Kelver Merlotti
 
PPTX
Kuasmun second class - ROP
kuasmun_2014
 
PDF
Dr browns
pospelov72
 
PDF
CrowdTruth @DIR2015
Anca Dumitrache
 
PPTX
Linden lab
Ankur Mukherjee
 
PPTX
Royale Business Presentation 2014 - U.S.A Distributor
Nikki Albright
 
PDF
CCA EAP Capabilities
CCA Inc
 
PDF
Oregon Rural Entrepreneurship Development Initiative REDI
Heather Stafford
 
PPTX
Khopoli & khalapur project market anaylsis consolidated
sunil seth kakkad
 
PPTX
INDUSTRIAL DEVELOPMENT SIZING & PRICING IN INDIA FOR INDUSTRIAL TOWNSHIP IN...
sunil seth kakkad
 
Rest api design by george reese
buildacloud
 
Final Master's Defense Presentation : Policy-driven Security Management in Ga...
Clinton DSouza
 
REST in short
Akshay Ballarpure
 
Introduction to REST API with Node.js
Yoann Gotthilf
 
Laravel Restful API and AngularJS
Blake Newman
 
How to connect AngularJS to servers
Carlos Morales
 
Angularjs & REST
Corley S.r.l.
 
How to Release Rock-solid RESTful APIs and Ice the Testing BackBlob
Bob Binder
 
Datasnap avançado - Respostas para um sistema robusto - Embarcadero Conferenc...
Kelver Merlotti
 
Kuasmun second class - ROP
kuasmun_2014
 
Dr browns
pospelov72
 
CrowdTruth @DIR2015
Anca Dumitrache
 
Linden lab
Ankur Mukherjee
 
Royale Business Presentation 2014 - U.S.A Distributor
Nikki Albright
 
CCA EAP Capabilities
CCA Inc
 
Oregon Rural Entrepreneurship Development Initiative REDI
Heather Stafford
 
Khopoli & khalapur project market anaylsis consolidated
sunil seth kakkad
 
INDUSTRIAL DEVELOPMENT SIZING & PRICING IN INDIA FOR INDUSTRIAL TOWNSHIP IN...
sunil seth kakkad
 
Ad

Similar to REST API Design (20)

PDF
IRJET- Rest API for E-Commerce Site
IRJET Journal
 
PPTX
Tutorial_Rest_API_For_Beginners_125.pptx
T.Choithram & Sons Dubai
 
PPTX
REST API
Kanushka Gayan
 
PPTX
80068
DEEPIKA T
 
PPTX
rest-api-basics.pptx
AgungSutikno1
 
PPTX
REST and RESTful Services
Damian T. Gordon
 
PDF
REST APIS web development for backend familiarity
ARTUROGOMEZGARCIA2
 
PPTX
Rest APIs Training
Shekhar Kumar
 
PPTX
RESTful Architecture
Kabir Baidya
 
PPTX
C# REST API
Simplilearn
 
PPTX
JAX-RS. Developing RESTful APIs with Java
Jerry Kurian
 
PPTX
RESTful APIs
Adi Challa
 
PDF
Rest API Interview Questions PDF By ScholarHat
Scholarhat
 
PPTX
Rest api design
Rudra Tripathy
 
PPTX
Rest surekha
Surekha Achanta
 
PDF
Web APIs
Carlos Santos
 
PPTX
RESTful services
Pedram Bashiri
 
PDF
Rest API Automation with REST Assured
TO THE NEW Pvt. Ltd.
 
PPTX
Http and REST APIs.
Rahul Tanwani
 
IRJET- Rest API for E-Commerce Site
IRJET Journal
 
Tutorial_Rest_API_For_Beginners_125.pptx
T.Choithram & Sons Dubai
 
REST API
Kanushka Gayan
 
80068
DEEPIKA T
 
rest-api-basics.pptx
AgungSutikno1
 
REST and RESTful Services
Damian T. Gordon
 
REST APIS web development for backend familiarity
ARTUROGOMEZGARCIA2
 
Rest APIs Training
Shekhar Kumar
 
RESTful Architecture
Kabir Baidya
 
C# REST API
Simplilearn
 
JAX-RS. Developing RESTful APIs with Java
Jerry Kurian
 
RESTful APIs
Adi Challa
 
Rest API Interview Questions PDF By ScholarHat
Scholarhat
 
Rest api design
Rudra Tripathy
 
Rest surekha
Surekha Achanta
 
Web APIs
Carlos Santos
 
RESTful services
Pedram Bashiri
 
Rest API Automation with REST Assured
TO THE NEW Pvt. Ltd.
 
Http and REST APIs.
Rahul Tanwani
 
Ad

Recently uploaded (20)

PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Digital Circuits, important subject in CS
contactparinay1
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 

REST API Design

  • 1. REST API By Devi Kiran KickStartPros.com [email protected]
  • 2. • JSON1 • REST API2 • JS libs and Play3 Agenda
  • 3. JSON • JSON = JavaScript Object Notation • Lightweight data interchange format • Organization with Employees
  • 4. REST API & DESIGN
  • 5. What is REST? • REST = REpresentational State Transfer • Architectural Constraints – Client-Server – Uniform Interface – Stateless – Cacheable – Layered System – Code on demand
  • 6. REST - Resource Based REST • Nouns, Not Verbs • Things are identified by URIs • Person, User, Address resource • HTTP Verb to dictate the operation on that resource. • Multiple URIs pointing to same resource. SOAP - RPC • Verbs or Actions. • RPC calls (Don’t do this in REST) – getUserData – getAllUsers – searchUsers – getUserAddress – updateUserAddress – deleteUser
  • 7. Representations • Represent part of the resource state. • JSON or XML • Example: Buy a car – Resource: Car (Audi A1) – Service: Buy (POST) – Representation: • Name, Model, Price • JSON or XML format.
  • 8. REST API Design Different REST Clients iPhone App Browser/ Web Android App DELETE PUT GET POST CUSTOM Params Http Methods Your App Server Load balanced App Server 1 App Server App Server App Server 1…n KickStartPros.com Http/s JSON/XML JSON/XML JSON/XML
  • 9. HTTP Methods & Status Codes • GET • HEAD • POST • PUT • DELETE • TRACE • OPTIONS • 2xx Success – 200 Ok – 204 No Content • 3xx Redirect – 304 Not Modified • 4xx Client Error – 400 Bad Request – 401 Unauthorized – 403 Forbidden – 404 Not Found • 5xx Server Error – 500 Internal Server Error
  • 10. Keep Http/s Simple • Resources – URI format – Collection Resources (/users) – Instance Resources (/users/ayl23d) • Behavior – Use Http Methods => CURD Database/Server Actions – POST => Create – GET => Read – PUT => Update – DELETE => Delete – HEAD => Headers, no body • Media types – application/json – application/xml
  • 11. Post for Create POST /users { “name” : “Kiran” } Response: 201 Created Location: http://www.kickstartpros.com/users/gdk23
  • 12. Put for Update PUT /users/<userId> PUT /users/gdk23 { “name” : “Devi Kiran” “description”: “Trainer” }
  • 13. Post for Update POST /users/<userId> POST /users/gdk23 { “name”: “Devi Kiran” } (Partial update or Full update) Response: 200 OK
  • 15. Client and Server • Uniform Interface Decouples Client and Server • Design – http and URIs – HTTP verbs (GET, PUT, POST, DELETE) – URIs – HTTP response • Status • Body
  • 16. Uniform interface • The uniform interface decouples client and Server – Identification of resources – Manipulation of resources through these representations – Self-descriptive messages
  • 17. HATEOAS • Hypermedia as the engine of application state • Client to Server – Body Content – URI and Query String parameters – Request Headers • Server – Body Content – Response Codes – Response Headers
  • 18. Stateless • No client state at server. • Any State is maintained at Client side. • Each request has all the information to process the request. Client 1 Client 2 Client 3 Servers
  • 19. More … • Layered System – A client cannot tell whether it is connected directly to the server. – Load balanced Servers – More Performance • Cacheable – Implicit – Explicit
  • 20. REST APIS & PLAY
  • 21. Example URIs • GMail Rest API (v1 Reference by resource type) • Custom REST API from Yahoo – https://developer.yahoo.com/yql/console/ – Example: get san francisco geo data: select * from geo.places where text=“san francisco, ca”
  • 22. UI Data binding of REST API • JQuery – Ajax calls • Data Binding JS libs that help to bind with REST response – JQuery UI – Widgets – Knockout – Model-View-ViewModel (MVVM) – Angular JS – MVVM & MVC – Backbone.js – RESTful JSON interface – Ember.js – Template language, MVC and a router – Kendo UI – MVVM – Extjs – MVC (Model View Controller) & widgets
  • 23. Summary & Reference • JSON & REST Architecture • Resource based REST API = Micro Services (SOA) • REST API & Examples with JS libs • Reference – Wiki • [email protected] – Join our trainings. – Kick Start your project with us.