API guidelines
These rules must be followed when creating new API endpoint in BobaBackend. They're a subset of the excellent Zalando RESTful API guidelines.
The Golden Rule
- MUST document every endpoint using the OpenAPI format (see How to Write Documentation).
Request Format
- MUST use HTTP methods correctly. (link)
- For a more compact explanation see this guide.
- MUST avoid actions — think about resources. (link)
- See RESTful API Design: nouns are good, verbs are bad for an explanation.
- MUST pluralize resource names. (link)
- MUST use lowercase separate words with hyphens for path segments. (link)
- MUST use snake_case (never camelCase) for query parameters. (link)
- MUST stick to conventional query parameters (link). This is relevant to operations like searching, sorting, filtering, and paginating.
Response Format
- MUST use standard HTTP status codes. (link)
- See full list at httpstatuses.com.
- MUST always return JSON objects as top-level data structures. (link)
- MUST follow all of the Zalando JSON Guidelines. (link) Particularly:
- SHOULD pluralize array names.
- MUST use ASCII snakecase for property names (and never camelCase): `^[a-z][a-z_0-9]*$`.
- SHOULD not use null for empty arrays.
- MUST not use null for boolean properties.
- SHOULD name date/time properties with _at suffix.
- MUST use same semantics for null and absent properties.
- MUST use standard data formats. (link)