HTTP · Schema

HTTP Request Message

Schema describing the structure of an HTTP request message as defined in RFC 9110 (HTTP Semantics) and RFC 9112 (HTTP/1.1).

NetworkingProtocolStandardsWeb

Properties

Name Type Description
method string The HTTP method indicating the desired action to be performed on the target resource (RFC 9110 Section 9).
target string The request target identifying the resource upon which to apply the request (RFC 9112 Section 3.2).
httpVersion string The HTTP version used for the request message (RFC 9112 Section 2.3).
headers object HTTP header fields that convey additional information about the request or the client (RFC 9110 Section 6.3).
body object The message body containing the payload data of the request (RFC 9110 Section 6.4).
View JSON Schema on GitHub

JSON Schema

http-request.json Raw ↑
{
  "$id": "http-request.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "HTTP Request Message",
  "description": "Schema describing the structure of an HTTP request message as defined in RFC 9110 (HTTP Semantics) and RFC 9112 (HTTP/1.1).",
  "type": "object",
  "required": [
    "method",
    "target"
  ],
  "properties": {
    "method": {
      "type": "string",
      "description": "The HTTP method indicating the desired action to be performed on the target resource (RFC 9110 Section 9).",
      "enum": [
        "GET",
        "HEAD",
        "POST",
        "PUT",
        "DELETE",
        "CONNECT",
        "OPTIONS",
        "TRACE",
        "PATCH"
      ]
    },
    "target": {
      "type": "string",
      "description": "The request target identifying the resource upon which to apply the request (RFC 9112 Section 3.2).",
      "examples": [
        "/api/resources",
        "/users/123",
        "https://example.com/api"
      ]
    },
    "httpVersion": {
      "type": "string",
      "description": "The HTTP version used for the request message (RFC 9112 Section 2.3).",
      "pattern": "^HTTP/[0-9]+(\\.[0-9]+)?$",
      "examples": [
        "HTTP/1.1",
        "HTTP/2",
        "HTTP/3"
      ]
    },
    "headers": {
      "type": "object",
      "description": "HTTP header fields that convey additional information about the request or the client (RFC 9110 Section 6.3).",
      "properties": {
        "Host": {
          "type": "string",
          "description": "The host and optional port of the target URI (RFC 9110 Section 7.2)."
        },
        "Content-Type": {
          "type": "string",
          "description": "The media type of the request body (RFC 9110 Section 8.3).",
          "examples": [
            "application/json",
            "application/x-www-form-urlencoded",
            "multipart/form-data"
          ]
        },
        "Content-Length": {
          "type": "integer",
          "description": "The size of the request body in bytes (RFC 9110 Section 8.6).",
          "minimum": 0
        },
        "Accept": {
          "type": "string",
          "description": "Media types acceptable for the response (RFC 9110 Section 12.5.1).",
          "examples": [
            "application/json",
            "text/html",
            "*/*"
          ]
        },
        "Authorization": {
          "type": "string",
          "description": "Credentials for authenticating the client with the server (RFC 9110 Section 11.6.2).",
          "examples": [
            "Bearer <token>",
            "Basic <credentials>"
          ]
        },
        "User-Agent": {
          "type": "string",
          "description": "Information about the user agent originating the request (RFC 9110 Section 10.1.5)."
        },
        "Cache-Control": {
          "type": "string",
          "description": "Directives for caching mechanisms in the request chain (RFC 9111 Section 5.2).",
          "examples": [
            "no-cache",
            "no-store",
            "max-age=3600"
          ]
        },
        "If-None-Match": {
          "type": "string",
          "description": "Conditional request based on entity tag comparison (RFC 9110 Section 13.1.2)."
        },
        "If-Modified-Since": {
          "type": "string",
          "description": "Conditional request based on modification date (RFC 9110 Section 13.1.3).",
          "format": "date-time"
        }
      },
      "additionalProperties": {
        "type": "string"
      }
    },
    "body": {
      "description": "The message body containing the payload data of the request (RFC 9110 Section 6.4)."
    }
  },
  "additionalProperties": false
}