Explore tens of thousands of sets crafted by our community.
RESTful API Principles
12
Flashcards
0/12
Self-descriptive Messages
RESTful API messages are self-descriptive, meaning they contain all the information needed to understand the request or response. This is typically achieved through the use of HTTP headers and status codes. Example: Content-Type header indicating the format of the message body.
HATEOAS (Hypermedia As The Engine Of Application State)
HATEOAS is a constraint of RESTful APIs which enables the client to dynamically navigate to various resource states of the application through hyperlinks. Example: Response contains links to other actions related to the resource.
Layered System
A Layered System is a REST principle where a client interacts with an API without knowing the inner layers of the network system. This allows for scalability and management enhancements. Example: A client uses a REST API without knowing if there's a load balancer.
Code on Demand (optional)
Code on Demand is an optional principle of RESTful APIs allowing the server to extend client functionality by sending code to the client that can be executed. Example: JavaScript code sent with a response, executed by the client.
Resource-Based URLs
Resource-Based URLs in RESTful APIs refer to URLs that are organized according to the system's data architecture, allowing intuitive access and manipulation of resources. Example: GET /orders/ for accessing orders; POST /orders/ to create a new order.
Idempotence
In RESTful APIs, an idempotent HTTP method means that, no matter how many times it's called, the result remains the same on the server. Example: DELETE and PUT requests should be idempotent.
Statelessness
In RESTful APIs, statelessness means that each HTTP request from a client contains all the information needed to process the request. The server does not store anything about the user's state. Example: A client provides authentication credentials with each request.
Cacheability
Cacheability is a principle whereby RESTful APIs are designed to support caching of responses. This can reduce the need for repeated server-side processing and improve performance. Example: A web application caches GET requests for user profiles.
Resource Identification in Requests
Resources are identified using URIs in RESTful APIs, providing a simple way for clients to point to a specific item within a dataset. Example: Accessing a user with GET /users/123
Resource Manipulation through Representations
Clients interact with RESTful APIs by exchanging representations of resources, such as JSON or XML, which capture the current or intended state of those resources. Example: Updating a user's profile using a JSON representation with a PUT request.
Client-Server Architecture
In RESTful APIs, a client-server architecture separates client concerns from server concerns. Clients handle the user interface while servers handle data storage and processing. Example: A mobile app (client) communicates with a REST API (server) to fetch data.
Uniform Interface
Uniform Interface is a REST principle that simplifies the architecture and decouples the client from the server. It involves using standardized operations like HTTP verbs (GET, POST, PUT, DELETE). Example: Accessing resources with URIs and manipulating them via HTTP methods.
© Hypatia.Tech. 2024 All rights reserved.