SlideShare a Scribd company logo
REST API in ASP Core
Irina Scurtu
.NET Technical Lead
Trainer @ Scoala Informala
@Fortech
REST Api with Asp Core
AGENDA
What is REST| 1
REST Constraints| 2
HTTP Status Codes| 3
HTTP Headers | 4
Richardson Maturity Model | 5
Copyright 2017 © Fortech. All rights reserved.
WHAT IS REST
REST
▪ Architectural style
▪ The architectural style of web
▪ Everything is a resource
Did you know?
Did you know?
REST
CONSTRAINTS
CLIENT-SERVER
▪ We need to have a server
▪ We need to have a client
▪ The server is not aware of the client
▪ The server does data transformation
under the hood
▪ The client simply uses the resources
Client
Server
Request/Response
STATELESS
State
Cookie
Session
Hidden
fields
Others?
STATELESS
▪The server keeps no state
▪ No identifier, no trace at all
▪If there is a trace, it’s contained in the request
▪ Eg: authentication details
▪The server treats each request as a new one
CACHE
▪The most important spec of the HTTP
▪The server must mark the response as cacheable
or not cacheable
▪It may increase the perceived performance
▪It may save database roundrips especially if the
data doesn’t change often
▪Done through headers
LAYERED SYSTEM
▪ The client can talk with an intermediate
▪ It only receives the resource
▪ It doesn’t matter if there is a load balancer involved or
a proxy, or a gateway
UNIFORM RESOURCE
▪Everything is a resource
▪A resource is anything that can be named
▪Every resource must have an URL
▪ Any document that can be read on the client, is a
representation of a resource
▪ Has 4 subconstraints
1.IDENTIFICATION OF RESOURCES
▪A resource needs to be addressable
▪A resource doesn’t correspond to a database table
▪It can be a subset, or a transformed entity
1.IDENTIFICATION OF RESOURCES
1.IDENTIFICATION OF RESOURCES
▪ /getLocation
▪ /newCat
▪ /feedCat
▪ /getAllCats
▪ /getBlackCats
▪ /getHungerLevel
▪ /getCatOwners
BAD!!!!
Hard to
remember!
2.MANIPULATION OF RESOURCES THROUGH
REPRESENTATIONS
▪A client doesn’t interact with the domain objects
▪It doesn’t query the database directly
▪It sends a representation of a resource to be
updated
3.SELF-DESCRIPTIVE MESSAGES
▪Each request/response includes details and
meaning
▪Each request/response must be able to be
understood in isolation
▪Add meaning through:
3.SELF-DESCRIPTIVE MESSAGES
Request/Response
Verbs
Media
types
Headers
Status
Codes
REST Api with Asp Core
4.HATEOAS
▪Hypermedia as engine of application state
▪ We should use the links( hypermedia with text) to
navigate the app
▪ A response should include a links section that allows
the hierarchical navigation
{
"links": {
{“rel": “self” , "href": "/superheroes" },
{“rel”: "next“, "href": "/superheroes?page=2" }
}
}
4.HATEOAS
Superheroes?page=2 superheroes
superheroes/3
superheroes/3/friends
Superheroes/3/friends/2
4.HATEOAS
root
/superheroes
By Id
/superHeroes/3
Relational
/superheroes/3/friends
Let’s talk about
endpoints
2 URLs for each resource
A collection
/superheroes/getAll
vs
/superheroes
An element
/superheroes/getSuperhero?id=1
vs
/superheroes/1
Guidelines
▪ Cool URIs don't change
▪ Use nouns not verbs
▪ Plural not singular
▪ Concrete
/things vs /dogs
▪ Variations - > query strings - not different endpoints
Status Codes
OK ?! 200
Or When OK really means OK
201
202 - Accepted
- For further processing
- For enqueuing something
204 – No content
- After deleting a resource
401
403
- Identified but not allowed to perform an
operation
Inapropriate picture
404
405 – Not Allowed
406 – Not Acceptable
- Accept header – xml
- Server does only json
Server Client
Sends only xml
Knows to read
only json
409
415
Accept header has a media type you
don’t support
Header fields
A suuuuuper small list
Accept
▪ The mime type the client prefers and understands
Accept : text/xml
Accept : application/json
Content-Type
▪ The mime type of the request body
▪ Describes the content of the request
Content-Type : text/xml
Location
▪ After a non-idempotent operation
Cache-Control
Cache-Control : no-cache
max-age=x(seconds)
Richardson
Maturity Model
Level 0
▪ YOU KNOW how to use it
▪ Single endpoint
• Go to a restaurant and order pizza, curry and Chinese
The food is good?
Level 1
▪ One verb - different locations
• Go to the italian restaurant to order pizza
• Go to the Chinese restaurant to order Chinese food
• Go to the Indian restaurant to order curry
Level 2
▪Uses Http Verbs and multiple resource endpoints
• Order a pizza from Italian restaurant
• After 5 minutes change the order to add extra
mozzarella
Level 3
▪Http Verbs and multiple resource endpoints
+ options
• Order a pizza
• Get the pizza
• Waiter gives info about the available toppings for
the pizza
• Informs you that they have other pizza types
RMM
HTTP verbs+ URI +
Hypermedia = HATEOAS
HTTP verbs + multiple URI
single verb +multiple URI
One Verb + one URI
WHY - Benefits
▪ ?
▪ ?
▪ ?
▪ ?
THANK YOU
Q&A
REST Api with Asp Core

More Related Content

Similar to REST Api with Asp Core (20)

Rest APIs Training
Rest APIs TrainingRest APIs Training
Rest APIs Training
Shekhar Kumar
 
What is REST?
What is REST?What is REST?
What is REST?
Saeid Zebardast
 
REST Methodologies
REST MethodologiesREST Methodologies
REST Methodologies
jrodbx
 
rest-api-basics.pptx
rest-api-basics.pptxrest-api-basics.pptx
rest-api-basics.pptx
AgungSutikno1
 
REST APIS web development for backend familiarity
REST APIS web development for backend familiarityREST APIS web development for backend familiarity
REST APIS web development for backend familiarity
ARTUROGOMEZGARCIA2
 
RESTful APIs
RESTful APIsRESTful APIs
RESTful APIs
Adi Challa
 
rest-api-basics.pptx
rest-api-basics.pptxrest-api-basics.pptx
rest-api-basics.pptx
FikiRieza2
 
Real world RESTful service development problems and solutions
Real world RESTful service development problems and solutionsReal world RESTful service development problems and solutions
Real world RESTful service development problems and solutions
Bhakti Mehta
 
L18 REST API Design
L18 REST API DesignL18 REST API Design
L18 REST API Design
Ólafur Andri Ragnarsson
 
Http and REST APIs.
Http and REST APIs.Http and REST APIs.
Http and REST APIs.
Rahul Tanwani
 
RESTful APIs in .NET
RESTful APIs in .NETRESTful APIs in .NET
RESTful APIs in .NET
Greg Sohl
 
RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座
Li Yi
 
RESTful Services
RESTful ServicesRESTful Services
RESTful Services
Jason Gerard
 
Embracing HTTP in the era of API’s
Embracing HTTP in the era of API’sEmbracing HTTP in the era of API’s
Embracing HTTP in the era of API’s
Visug
 
Restful web-services
Restful web-servicesRestful web-services
Restful web-services
rporwal
 
Rest WebAPI with OData
Rest WebAPI with ODataRest WebAPI with OData
Rest WebAPI with OData
Mahek Merchant
 
WebApp #3 : API
WebApp #3 : APIWebApp #3 : API
WebApp #3 : API
Jean Michel
 
REST Api Tips and Tricks
REST Api Tips and TricksREST Api Tips and Tricks
REST Api Tips and Tricks
Maksym Bruner
 
Rest web services
Rest web servicesRest web services
Rest web services
Paulo Gandra de Sousa
 
Tutorial_Rest_API_For_Beginners_125.pptx
Tutorial_Rest_API_For_Beginners_125.pptxTutorial_Rest_API_For_Beginners_125.pptx
Tutorial_Rest_API_For_Beginners_125.pptx
T.Choithram & Sons Dubai
 
REST Methodologies
REST MethodologiesREST Methodologies
REST Methodologies
jrodbx
 
rest-api-basics.pptx
rest-api-basics.pptxrest-api-basics.pptx
rest-api-basics.pptx
AgungSutikno1
 
REST APIS web development for backend familiarity
REST APIS web development for backend familiarityREST APIS web development for backend familiarity
REST APIS web development for backend familiarity
ARTUROGOMEZGARCIA2
 
rest-api-basics.pptx
rest-api-basics.pptxrest-api-basics.pptx
rest-api-basics.pptx
FikiRieza2
 
Real world RESTful service development problems and solutions
Real world RESTful service development problems and solutionsReal world RESTful service development problems and solutions
Real world RESTful service development problems and solutions
Bhakti Mehta
 
RESTful APIs in .NET
RESTful APIs in .NETRESTful APIs in .NET
RESTful APIs in .NET
Greg Sohl
 
RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座
Li Yi
 
Embracing HTTP in the era of API’s
Embracing HTTP in the era of API’sEmbracing HTTP in the era of API’s
Embracing HTTP in the era of API’s
Visug
 
Restful web-services
Restful web-servicesRestful web-services
Restful web-services
rporwal
 
Rest WebAPI with OData
Rest WebAPI with ODataRest WebAPI with OData
Rest WebAPI with OData
Mahek Merchant
 
REST Api Tips and Tricks
REST Api Tips and TricksREST Api Tips and Tricks
REST Api Tips and Tricks
Maksym Bruner
 

Recently uploaded (20)

COBOL Programming with VSCode - IBM Certificate
COBOL Programming with VSCode - IBM CertificateCOBOL Programming with VSCode - IBM Certificate
COBOL Programming with VSCode - IBM Certificate
VICTOR MAESTRE RAMIREZ
 
Top 11 Fleet Management Software Providers in 2025 (2).pdf
Top 11 Fleet Management Software Providers in 2025 (2).pdfTop 11 Fleet Management Software Providers in 2025 (2).pdf
Top 11 Fleet Management Software Providers in 2025 (2).pdf
Trackobit
 
Top 5 Task Management Software to Boost Productivity in 2025
Top 5 Task Management Software to Boost Productivity in 2025Top 5 Task Management Software to Boost Productivity in 2025
Top 5 Task Management Software to Boost Productivity in 2025
Orangescrum
 
Essentials of Resource Planning in a Downturn
Essentials of Resource Planning in a DownturnEssentials of Resource Planning in a Downturn
Essentials of Resource Planning in a Downturn
OnePlan Solutions
 
Bonk coin airdrop_ Everything You Need to Know.pdf
Bonk coin airdrop_ Everything You Need to Know.pdfBonk coin airdrop_ Everything You Need to Know.pdf
Bonk coin airdrop_ Everything You Need to Know.pdf
Herond Labs
 
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI SearchAgentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Maxim Salnikov
 
Automating Map Production With FME and Python
Automating Map Production With FME and PythonAutomating Map Production With FME and Python
Automating Map Production With FME and Python
Safe Software
 
From Chaos to Clarity - Designing (AI-Ready) APIs with APIOps Cycles
From Chaos to Clarity - Designing (AI-Ready) APIs with APIOps CyclesFrom Chaos to Clarity - Designing (AI-Ready) APIs with APIOps Cycles
From Chaos to Clarity - Designing (AI-Ready) APIs with APIOps Cycles
Marjukka Niinioja
 
Design by Contract - Building Robust Software with Contract-First Development
Design by Contract - Building Robust Software with Contract-First DevelopmentDesign by Contract - Building Robust Software with Contract-First Development
Design by Contract - Building Robust Software with Contract-First Development
Par-Tec S.p.A.
 
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
Neuralink TemplateeeeeeeeeeeeeeeeeeeeeeeeeeNeuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
alexandernoetzold
 
Build enterprise-ready applications using skills you already have!
Build enterprise-ready applications using skills you already have!Build enterprise-ready applications using skills you already have!
Build enterprise-ready applications using skills you already have!
PhilMeredith3
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines OperationsHow Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
How to Generate Financial Statements in QuickBooks Like a Pro (1).pdf
How to Generate Financial Statements in QuickBooks Like a Pro (1).pdfHow to Generate Financial Statements in QuickBooks Like a Pro (1).pdf
How to Generate Financial Statements in QuickBooks Like a Pro (1).pdf
QuickBooks Training
 
Best Inbound Call Tracking Software for Small Businesses
Best Inbound Call Tracking Software for Small BusinessesBest Inbound Call Tracking Software for Small Businesses
Best Inbound Call Tracking Software for Small Businesses
TheTelephony
 
Micro-Metrics Every Performance Engineer Should Validate Before Sign-Off
Micro-Metrics Every Performance Engineer Should Validate Before Sign-OffMicro-Metrics Every Performance Engineer Should Validate Before Sign-Off
Micro-Metrics Every Performance Engineer Should Validate Before Sign-Off
Tier1 app
 
Online Queue Management System for Public Service Offices [Focused on Municip...
Online Queue Management System for Public Service Offices [Focused on Municip...Online Queue Management System for Public Service Offices [Focused on Municip...
Online Queue Management System for Public Service Offices [Focused on Municip...
Rishab Acharya
 
OpenTelemetry 101 Cloud Native Barcelona
OpenTelemetry 101 Cloud Native BarcelonaOpenTelemetry 101 Cloud Native Barcelona
OpenTelemetry 101 Cloud Native Barcelona
Imma Valls Bernaus
 
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptxIMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
usmanch7829
 
FME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable InsightsFME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable Insights
Safe Software
 
AI and Deep Learning with NVIDIA Technologies
AI and Deep Learning with NVIDIA TechnologiesAI and Deep Learning with NVIDIA Technologies
AI and Deep Learning with NVIDIA Technologies
SandeepKS52
 
COBOL Programming with VSCode - IBM Certificate
COBOL Programming with VSCode - IBM CertificateCOBOL Programming with VSCode - IBM Certificate
COBOL Programming with VSCode - IBM Certificate
VICTOR MAESTRE RAMIREZ
 
Top 11 Fleet Management Software Providers in 2025 (2).pdf
Top 11 Fleet Management Software Providers in 2025 (2).pdfTop 11 Fleet Management Software Providers in 2025 (2).pdf
Top 11 Fleet Management Software Providers in 2025 (2).pdf
Trackobit
 
Top 5 Task Management Software to Boost Productivity in 2025
Top 5 Task Management Software to Boost Productivity in 2025Top 5 Task Management Software to Boost Productivity in 2025
Top 5 Task Management Software to Boost Productivity in 2025
Orangescrum
 
Essentials of Resource Planning in a Downturn
Essentials of Resource Planning in a DownturnEssentials of Resource Planning in a Downturn
Essentials of Resource Planning in a Downturn
OnePlan Solutions
 
Bonk coin airdrop_ Everything You Need to Know.pdf
Bonk coin airdrop_ Everything You Need to Know.pdfBonk coin airdrop_ Everything You Need to Know.pdf
Bonk coin airdrop_ Everything You Need to Know.pdf
Herond Labs
 
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI SearchAgentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Maxim Salnikov
 
Automating Map Production With FME and Python
Automating Map Production With FME and PythonAutomating Map Production With FME and Python
Automating Map Production With FME and Python
Safe Software
 
From Chaos to Clarity - Designing (AI-Ready) APIs with APIOps Cycles
From Chaos to Clarity - Designing (AI-Ready) APIs with APIOps CyclesFrom Chaos to Clarity - Designing (AI-Ready) APIs with APIOps Cycles
From Chaos to Clarity - Designing (AI-Ready) APIs with APIOps Cycles
Marjukka Niinioja
 
Design by Contract - Building Robust Software with Contract-First Development
Design by Contract - Building Robust Software with Contract-First DevelopmentDesign by Contract - Building Robust Software with Contract-First Development
Design by Contract - Building Robust Software with Contract-First Development
Par-Tec S.p.A.
 
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
Neuralink TemplateeeeeeeeeeeeeeeeeeeeeeeeeeNeuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
alexandernoetzold
 
Build enterprise-ready applications using skills you already have!
Build enterprise-ready applications using skills you already have!Build enterprise-ready applications using skills you already have!
Build enterprise-ready applications using skills you already have!
PhilMeredith3
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines OperationsHow Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
How to Generate Financial Statements in QuickBooks Like a Pro (1).pdf
How to Generate Financial Statements in QuickBooks Like a Pro (1).pdfHow to Generate Financial Statements in QuickBooks Like a Pro (1).pdf
How to Generate Financial Statements in QuickBooks Like a Pro (1).pdf
QuickBooks Training
 
Best Inbound Call Tracking Software for Small Businesses
Best Inbound Call Tracking Software for Small BusinessesBest Inbound Call Tracking Software for Small Businesses
Best Inbound Call Tracking Software for Small Businesses
TheTelephony
 
Micro-Metrics Every Performance Engineer Should Validate Before Sign-Off
Micro-Metrics Every Performance Engineer Should Validate Before Sign-OffMicro-Metrics Every Performance Engineer Should Validate Before Sign-Off
Micro-Metrics Every Performance Engineer Should Validate Before Sign-Off
Tier1 app
 
Online Queue Management System for Public Service Offices [Focused on Municip...
Online Queue Management System for Public Service Offices [Focused on Municip...Online Queue Management System for Public Service Offices [Focused on Municip...
Online Queue Management System for Public Service Offices [Focused on Municip...
Rishab Acharya
 
OpenTelemetry 101 Cloud Native Barcelona
OpenTelemetry 101 Cloud Native BarcelonaOpenTelemetry 101 Cloud Native Barcelona
OpenTelemetry 101 Cloud Native Barcelona
Imma Valls Bernaus
 
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptxIMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
usmanch7829
 
FME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable InsightsFME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable Insights
Safe Software
 
AI and Deep Learning with NVIDIA Technologies
AI and Deep Learning with NVIDIA TechnologiesAI and Deep Learning with NVIDIA Technologies
AI and Deep Learning with NVIDIA Technologies
SandeepKS52
 
Ad

REST Api with Asp Core