snake_case or camelCase), predictable patterns.PUT is typically idempotent, POST often not.?cursor=...&limit=50?status=active&sort=-created_at/v1/...Accept: application/vnd.company.v1+json)Use exponential backoff and jitter.
Retry only on safe failures:
429, 503 (often)Never blindly retry non-idempotent operations without an idempotency key.
X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset (or standard equivalents)Nouns for resources:
GET /users/{id}GET /users?status=activeActions when needed:
POST /orders/{id}/cancelPOST /users/{id}:activate (some orgs prefer this style)PATCH /resource/{id} with a clear patch format:
ETag + If-None-MatchCache-ControlMethods are verbs:
CreateOrder, CancelOrder, GetOrderMap errors to a consistent set (gRPC status codes), include structured details.
Correlation id:
X-Request-Id / traceparentEmit structured logs (JSON), avoid logging secrets.
| Style | Contract | Transport | Best for | Trade-offs |
|---|---|---|---|---|
| REST | OpenAPI optional | HTTP/JSON | broad compatibility | versioning + consistency effort |
| GraphQL | Strong schema | HTTP | flexible client queries | query cost control, caching complexity |
| gRPC | Strong (protobuf) | HTTP/2 | internal high-perf calls | browser support constraints, tooling differences |
| SOAP | Strong (WSDL) | HTTP | legacy enterprise | verbosity, slower iteration |