Essensial REST concepts and continuing with HTTP verbs, Minimal Status Codes and Headers, this presentation will immerse you in a lot of fuzzy words(HATEOAS, RMM) and tweaks, all for ASP.NET Core.
9. 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
11. 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
12. 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
13. 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
14. 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
15. 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
17. 1.IDENTIFICATION OF RESOURCES
▪ /getLocation
▪ /newCat
▪ /feedCat
▪ /getAllCats
▪ /getBlackCats
▪ /getHungerLevel
▪ /getCatOwners
BAD!!!!
Hard to
remember!
18. 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
22. 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" }
}
}
46. Level 0
▪ YOU KNOW how to use it
▪ Single endpoint
• Go to a restaurant and order pizza, curry and Chinese
The food is good?
47. 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
48. 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
49. 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
50. RMM
HTTP verbs+ URI +
Hypermedia = HATEOAS
HTTP verbs + multiple URI
single verb +multiple URI
One Verb + one URI