Guia de entrevista · REST / HTTP

Which methods are idempotent? Which are safe?

do caderno de estudos · atualizado em 2 de outubro de 2026
Para quem vai encarar entrevista de REST / HTTP2 min

Parece simples até o entrevistador perguntar "why?". Abaixo, uma estrutura de resposta que dá conta do follow-up.

A resposta, como você fala na entrevista

Idempotent means repeating an identical request has the same intended effect on server state as making it once. Responses may differ. Deleting an existing resource can return 204, then 404 on a repeat, while remaining idempotent.
GET, HEAD, OPTIONS, TRACE, PUT, and DELETE have idempotent semantics. POST and PATCH are not guaranteed to be idempotent, but an API can make particular operations retry-safe.
GET, HEAD, OPTIONS, and TRACE are safe: the client does not request a state change. Logging is an allowed incidental side effect. Safe and idempotent are different properties.

Source: HTTP method semantics.

Ler é o primeiro passo. No app, essa pergunta vira flashcard com repetição espaçada, e o módulo tem quiz e simulado para testar o que ficou.

Treinar essa pergunta no app