Go

REST API Design

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

20 питань зі співбесід·
Mid-Level
1

What is the fundamental principle of REST?

Відповідь

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?

Відповідь

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?

Відповідь

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 питань зі співбесід

Опануй Go для наступної співбесіди

Отримай доступ до всіх питань, flashcards, технічних тестів, вправ code review та симуляторів співбесід.

Почни безкоштовно