REST Flashcards
What does the acronym REST stand for? What makes a service “RESTful”?
Representational State Transfer
It’s an architectural style for providing standards between computer systems on the web and makes it easier for systems to communicate with each other. A service is RESTful when it’s stateless, cacheable, has a uniform interface, client-server architecture, and a layered system.
What protocols and data format do REST services use?
Http protocols. REST services use JSON, XML and a variety of other data formats.
What are the architectural constraints of REST?
Uniform interface, client-server, stateless, cacheable, layered system
Uniform Interface (Constraint)
Be consistent in naming endpoints. Leverage http protocol for interacting with our api.
Client-server (Constraint)
Client and server must be able to evolve separately from one another. Client only needs to know URIs to resources exposed by the api
Stateless (Constraint)
The server will not store anything about the client’s request. Every request is a new request from the api perspective.
Cacheable (Constraint)
Resources that will not change should be cached to decrease latency of retrieval of frequently accessed resources.
Layered System (Constraint)
Different domains of the application are physically and logically separate from each other
Explain the levels of the Richardson Maturity Model
Level 0 - services have a single URI and a single HTTP method
Level 1 - services have many URIs but only a single HTTP method
Level 2 (most popular) - services have many URIs and support several CRUD services
Level 3 - makes use of URIs, HTTP, and HATEOAS
Explain the HATEOAS concept
Hypermedia As The Engine Of Application State
Keeps the REST style architecture unique from other network application architectures.
What is a “resource” in a REST service?
Any information that can be named. Similar to an entity in a database.
How would you implement authentication/authorization in a RESTful web service while maintaining statelessness?
You could use tokens to allow access to a specific service or resource without using credentials to authenticate every request so nothing is stored during the authentication request.