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

What are the core components of a HTTP response?

Câu trả lời

The core components of an HTTP response are:

  1. Status Line: This is the first line of the HTTP response and contains three key elements:

    • HTTP Version: Indicates the HTTP protocol version used, such as HTTP/1.1.
    • Status Code: A three-digit code that indicates the result of the HTTP request. Common status codes include 200 (OK), 404 (Not Found), and 500 (Internal Server Error).
    • Reason-Phrase: A brief textual description of the status code, such as "OK" for 200 or "Not Found" for 404[1][2][3].
  2. Headers: These provide additional information about the response. Headers are key-value pairs separated by a colon and can include:

    • Content-Type: Specifies the media type of the response body, such as text/html or application/json.
    • Content-Length: Indicates the size of the response body in bytes.
    • Date: The date and time at which the response was generated.
    • Server: Information about the server that generated the response.
    • Set-Cookie: Used to se...
middle

middle

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

senior

Khi thiết kế API cho marketplace (multi-role), bạn tách role-based logic như thế nào?

senior

Khi API có nhiều consumers (web, mobile, đối tác), bạn tổ chức endpoint như thế nào?

senior

Làm sao để thiết kế API có khả năng mở rộng (scalable API Design)?

Bình luận

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

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