Skip to content
ADP
API Design PrincipleBETA

[ADP-111] GET

Overview

The HTTP GET method is used to request data from a specified resource. Requests using GET should only retrieve data and should not have any other effect on the data.

Guidance

  • GET requests SHOULD NOT change the state of the resource. They can be repeated without causing different outcomes.
  • GET requests SHOULD NOT cause any side effects for which the user is held responsible.
  • Responses to GET requests SHOULD be cacheable to improve performance and reduce server load. See Cache Control.
  • MAY use query parameters to filter, sort, or paginate the data being requested. See Pagination, Sorting, Filtering.
  • MUST NOT add request body in GET requests.

Usage

  1. Keep GET requests idempotent
  2. Avoid using GET for operations that modify data
  3. Use meaningful and RESTful URL structures
  4. Implement proper error handling for GET requests
  5. Consider rate limiting for public GET endpoints

Example 1: Retrieve a list of users

Request:

http
GET /users

Response:

http
HTTP/1.1 200 OK

[
    {
        "id": 1,
        "name": "Alice"
    },
    {
        "id": 2,
        "name": "Bob"
    }
]

Example 2: Retrieve a single user by ID

Request:

http
GET /users/1 HTTP/1.1

Response:

http
HTTP/1.1 200 OK

{
    "id": 1,
    "name": "Alice"
}

Reference