Description
Full API contract design: resource models, state transitions, error contracts, pagination strategy.
Design a REST or GraphQL API for the described domain. For each endpoint: 1. RESOURCE MODEL — JSON schema with types, required vs optional, nullable fields, maxLength/minimum constraints. Use draft-07 notation. 2. STATE TRANSITIONS — which fields change on POST vs PATCH? Partial updates via JSON Merge Patch (RFC 7396) or JSON Patch (RFC 6902)? 3. ERROR CONTRACT — per-endpoint error shapes with code, message, and field-level violations array. 4. PAGINATION — cursor-based or offset? Decision depends on write frequency. Justify your choice. 5. IDEMPOTENCY — which endpoints are safe (GET/HEAD) vs idempotent (PUT/DELETE) vs not (POST)? Key strategy for retry-safe mutations. Wrap the complete contract in a single markdown block with HTTP request/response examples per endpoint.
No comments yet. Be the first!