Home » GET

GET

The GET method in a request message is used to retrieve the state of a resource, in some representational form. A client’s GET request message may contain headers but no body.

The architecture of the Web relies heavily on the nature of the GET method. Clients count on being able to repeat GET requests without causing side effects.

By safe, we mean a GET request generates no server-side side effects for which the client can be held responsible. There may still be side effects, but any that do occur are the sole responsibility of the service. For example, many services log GET requests, thereby changing some part of their state. But GET is still safe. Server-side logging is a private affair; clients don’t ask for something to be logged when they issue a GET request. Sending a GET request to the server should have the same effect on resource state as not sending a GET request—that is, no effect at all.

Because GET exhibits no side effects for which the consumer can be held responsible, it is naturally idempotent. Multiple GETs of the same URI generate the same result: they retrieve the state of the resource associated with that URI at the moment the request was received, even if they return different data (which can occur if the resource’s state changes in between requests).

Important features:

  – headers allowed, no body;
  – GET is curl’s default method;
  – When used properly, GET is both safe and idempotent;

GET method RFC
RFC 2731 4.3.1 https://httpwg.org/specs/rfc7231.html#rfc.section.4.3.1