GET Method

About1

The GET HTTP method (HTTP verb) requests a representation of the specified resource. Requests using GET should only retrieve data and should not contain a request content. Also see GET request .

Characteristics

Request has a bodySuccessful response has bodyIdempontentCacheableAllowed in HTML forms
NoYesYesYesYes

Syntax2

GET <request-target>["?"<query>] HTTP/1.1
  • <request-target>: identifies the target resource of the request when combined with the information provided in the

Host header. This is an absolute path (e.g. /path/to/file.html) in requests to an origin server, and an absolute URL in requests to proxies (e.g. http://www.example.com/path/to/file.html)

  • <query> (Optional) - an optional query component preceded by a question-mark ?. Often used to carry identifying

information in the form of key=value pairs.

Examples

Successfully retrieving a resource

The following GET request asks for the resource at example.com/contact:

GET /contact HTTP/1.1
Host: example.com
User-Agent: curl/8.6.0
Accept: */*

The server sends back the resource with a 200 OK status code, indicating success:

HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Date: Fri, 21 Jun 2024 14:18:33 GMT
Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT
Content-Length: 1234

<!doctype html>
<!-- HTML content follows -->

Anki

References


  1. MDN. “Methods”. Available at: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Methods . (Accessed: [2025-05-06 Tue 18:02]). ↩︎

  2. MDN. “GET”. Available at: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Methods/GET . (Accessed: [2025-05-06 Tue 18:07]). ↩︎

Random Posts