SlideShare a Scribd company logo
REST API in ASP Core
Irina Scurtu
.NET Technical Lead
Trainer @ Scoala Informala
@Fortech
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
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

API Testing Using REST Assured with TestNG
API Testing Using REST Assured with TestNGAPI Testing Using REST Assured with TestNG
API Testing Using REST Assured with TestNG
Siddharth Sharma
 
What is REST?
What is REST?What is REST?
What is REST?
Saeid Zebardast
 
Pragmatic REST APIs
Pragmatic REST APIsPragmatic REST APIs
Pragmatic REST APIs
amesar0
 
Api Design
Api DesignApi Design
Api Design
Jason Harmon
 
RESTful Services
RESTful ServicesRESTful Services
RESTful Services
Jason Gerard
 
Rest APIs Training
Rest APIs TrainingRest APIs Training
Rest APIs Training
Shekhar Kumar
 
Rest WebAPI with OData
Rest WebAPI with ODataRest WebAPI with OData
Rest WebAPI with OData
Mahek Merchant
 
Recipes for API Ninjas
Recipes for API NinjasRecipes for API Ninjas
Recipes for API Ninjas
Nordic APIs
 
Rest webservice ppt
Rest webservice pptRest webservice ppt
Rest webservice ppt
sinhatanay
 
JDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to you
JDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to youJDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to you
JDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to you
Alex Theedom
 
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
Masoud Kalali
 
Java EE 8: What Servlet 4.0 and HTTP2 mean to you
Java EE 8: What Servlet 4.0 and HTTP2 mean to youJava EE 8: What Servlet 4.0 and HTTP2 mean to you
Java EE 8: What Servlet 4.0 and HTTP2 mean to you
Alex Theedom
 
Java EE 8: What Servlet 4.0 and HTTP/2 mean to you
Java EE 8: What Servlet 4.0 and HTTP/2 mean to youJava EE 8: What Servlet 4.0 and HTTP/2 mean to you
Java EE 8: What Servlet 4.0 and HTTP/2 mean to you
Alex Theedom
 
Designing Practical RESTful APIs
Designing Practical RESTful APIsDesigning Practical RESTful APIs
Designing Practical RESTful APIs
Hiroshi Ogino
 
Attacking REST API
Attacking REST APIAttacking REST API
Attacking REST API
Siddharth Bezalwar
 
Java EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 MeanJava EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 Mean
Alex Theedom
 
Black and Blue APIs: Attacker's and Defender's View of API Vulnerabilities
Black and Blue APIs: Attacker's and Defender's View of API VulnerabilitiesBlack and Blue APIs: Attacker's and Defender's View of API Vulnerabilities
Black and Blue APIs: Attacker's and Defender's View of API Vulnerabilities
Matt Tesauro
 
REST & RESTful Web Service
REST & RESTful Web ServiceREST & RESTful Web Service
REST & RESTful Web Service
Hoan Vu Tran
 
Restful web services
Restful web servicesRestful web services
Restful web services
Surinder Mehra
 

Similar to REST Api with Asp Core (20)

API Testing Using REST Assured with TestNG
API Testing Using REST Assured with TestNGAPI Testing Using REST Assured with TestNG
API Testing Using REST Assured with TestNG
 
What is REST?
What is REST?What is REST?
What is REST?
 
Pragmatic REST APIs
Pragmatic REST APIsPragmatic REST APIs
Pragmatic REST APIs
 
Api Design
Api DesignApi Design
Api Design
 
RESTful Services
RESTful ServicesRESTful Services
RESTful Services
 
Rest APIs Training
Rest APIs TrainingRest APIs Training
Rest APIs Training
 
Rest WebAPI with OData
Rest WebAPI with ODataRest WebAPI with OData
Rest WebAPI with OData
 
RESTful APIs
RESTful APIsRESTful APIs
RESTful APIs
 
Recipes for API Ninjas
Recipes for API NinjasRecipes for API Ninjas
Recipes for API Ninjas
 
Rest webservice ppt
Rest webservice pptRest webservice ppt
Rest webservice ppt
 
JDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to you
JDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to youJDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to you
JDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to you
 
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
 
Java EE 8: What Servlet 4.0 and HTTP2 mean to you
Java EE 8: What Servlet 4.0 and HTTP2 mean to youJava EE 8: What Servlet 4.0 and HTTP2 mean to you
Java EE 8: What Servlet 4.0 and HTTP2 mean to you
 
Java EE 8: What Servlet 4.0 and HTTP/2 mean to you
Java EE 8: What Servlet 4.0 and HTTP/2 mean to youJava EE 8: What Servlet 4.0 and HTTP/2 mean to you
Java EE 8: What Servlet 4.0 and HTTP/2 mean to you
 
Designing Practical RESTful APIs
Designing Practical RESTful APIsDesigning Practical RESTful APIs
Designing Practical RESTful APIs
 
Attacking REST API
Attacking REST APIAttacking REST API
Attacking REST API
 
Java EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 MeanJava EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 Mean
 
Black and Blue APIs: Attacker's and Defender's View of API Vulnerabilities
Black and Blue APIs: Attacker's and Defender's View of API VulnerabilitiesBlack and Blue APIs: Attacker's and Defender's View of API Vulnerabilities
Black and Blue APIs: Attacker's and Defender's View of API Vulnerabilities
 
REST & RESTful Web Service
REST & RESTful Web ServiceREST & RESTful Web Service
REST & RESTful Web Service
 
Restful web services
Restful web servicesRestful web services
Restful web services
 

Recently uploaded

Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 

Recently uploaded (20)

Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 

REST Api with Asp Core