Skip to content
ADP
API Design PrincipleBETA

[ADP-318] Query Parameter Convention

Guidance

  • SHOULD use query parameters for GET requests

  • MAY use query parameters for POST requests

    TIP

    This is a convention rather than a hard and fast rule. For further discussion, refer to this and this.

    In my opinion, using both payload and query parameters simultaneously in a POST request can lead to fragmented input. From another perspective, being consistent with using payload means you need to move the common query parameters into payload and may need to design a new property/value pairing for them.

  • SHOULD use payload (body) for POST requests

  • SHOULD follow common query parameters:

  • MUST use camelCase for query parameters; use CamelCase to delimit combined words in query parameters.

    DO:

    raw
    productId, articleNumber, loginId, lId etc.

    DON'T:

    raw
    product_id, Articlenumber, login-id, LID

Example

DO

http
GET /events?occuredAt=2024-07-09T18:00:00Z
POST /search
{
  "occuredAt": "2024-07-09T18:00:00Z"
}

DON’T

http
POST /search?occuredAt=2024-07-09T18:00:00Z
GET /events
{
  "occuredAt": "2024-07-09T18:00:00Z"
}

Reference

Design Reference

Changelog

  • 2024.10.30: add query parameter tip for POST