Câu hỏi phỏng vấn API Design
Câu hỏi

What's the difference between REST & RESTful?

Câu trả lời

The terms "REST" and "RESTful" are often used interchangeably, but they have distinct meanings in the context of API design.

REST (Representational State Transfer)

REST is an architectural style for designing networked applications. It was introduced by Roy Fielding in his doctoral dissertation in 2000. REST defines a set of constraints to be used for creating web services. These constraints include:

  1. Client-Server Architecture: The client and server are separate entities that interact through a uniform interface.
  2. Statelessness: Each request from a client to a server must contain all the information needed to understand and process the request. The server does not store any client context between requests.
  3. Cacheability: Responses must be explicitly marked as cacheable or non-cacheable to prevent clients from reusing stale or inappropriate data.
  4. Uniform Interface: A standardized way of communicating between the client and server, typically using HTTP methods like GET, POST, PUT, DELETE, etc.
  5. Layered System: The architecture can be composed of multiple layers, with each layer only interacting with the layer directly adjacent to it.
  6. Code on Demand (optional): Servers can extend client functionality by transferring executable code.

RESTful

A RESTful API is an API that adheres to the principles and constraints of REST. In other words, it is an implementation of REST. When an API is described as RESTful, it means that it follows the REST architectural style and meets the following criteria:

  1. Uses HTTP Methods: The API uses standard HTTP methods (GET, POST, PUT, DELETE) to perform CRUD (Create, Read, Update, Delete) operations.
  2. Stateless Interactions: Each request from the client to the server must contain all the information needed to understand and process the request.
  3. Resource-Based: The API treats data and functionalities as resources that can be identified by URIs (Uniform Resource Identifiers).
  4. Supports Multiple Formats: The API can return data in various formats, such as JSON, XML, HTML, etc.
  5. Uniform Interface: The API uses a consistent an...
middle

middle

Gợi ý câu hỏi phỏng vấn

junior

What are different types of Web Services?

middle

What are the best practices to design a resource representation?

junior

Define what is SOA

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào