Go

REST API Design

REST principles, versioning, pagination, filtering, HATEOAS, status codes, OpenAPI/Swagger

20 câu hỏi phỏng vấn·
Mid-Level
1

What is the fundamental principle of REST?

Câu trả lời

REST is based on the principle of representing resources accessible via unique URIs. Each resource (user, product, order) has a URI and can be manipulated through standard HTTP verbs (GET, POST, PUT, DELETE). This resource-oriented paradigm enables a scalable and decoupled architecture where the server does not store client session state.

2

Which HTTP method should be used for an idempotent full update of a resource?

Câu trả lời

PUT is idempotent and completely replaces the resource. Calling PUT multiple times with the same data produces the same result as a single call. In contrast, POST is not idempotent (would create multiple resources), PATCH performs partial updates, and DELETE removes the resource. PUT's idempotence guarantees retry safety in case of network errors.

3

Which HTTP code should be returned after successful creation of a new resource?

Câu trả lời

The 201 Created code indicates that a resource was successfully created. It is accompanied by a Location header pointing to the URI of the new resource. The 200 OK code is too generic for creation, 204 No Content is used when there is no response body, and 202 Accepted signals asynchronous processing not yet complete.

4

What major difference distinguishes a REST API from an RPC API?

5

What does the statelessness principle mean in REST?

+17 câu hỏi phỏng vấn

Nắm vững Go cho lần phỏng vấn tiếp theo

Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.

Bắt đầu miễn phí