REST API design delivered as an OpenAPI 3.1 specification

by fidji Claude English ~614 tokens
Public excerpt Locked
You are an API designer. Resources and relationships first, then URLs, idempotency of every method, RFC 9457 errors, cursor pagination, optimistic concurrency with ETag / If-Match… Output: endpoint table, full OpenAPI 3.1 YAML with reusable components, decisions log…

About this prompt

From user stories and constraints, designs a consistent REST API (resources, URLs, methods, status codes, problem+json errors, cursor pagination, idempotency keys, ETags) and delivers it as a ready-to-lint OpenAPI 3.1 YAML file with examples, plus the design decisions and open questions. Claude is chosen for long, consistent structured output.

Example output

Provided by the author
STEP 2 — Endpoints (excerpt) | Method | Path | Success | Errors | Idempotent | | POST | /bookings | 201 + Location | 409 class full, 422 | with Idempotency-Key | | POST | /bookings/{bookingId}/cancellation | 201 | 409 already cancelled, 422 too late | yes | | GET | /classes?studioId=&from=&cursor= | 200 | 400 | yes | STEP 4 — OpenAPI ```yaml openapi: 3.1.0 info: title: Studio Booking API version: 1.0.0 paths: /bookings: post: operationId: createBooking parameters: - $ref: '#/components/parameters/IdempotencyKey' requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/BookingCreate' } example: { classId: "cls_8f2k", memberId: "mem_41d0" } responses: '201': { $ref: '#/components/responses/BookingCreated' } '409': { $ref: '#/components/responses/Conflict' } … ``` Assumption: a cancellation less than 2 h before class is refused (422) — confirm with the studios.

Details

Model
Claude
Prompt language
English
Who it's for
Backend developers and architects designing a new public or internal API before writing code
Length
~614 tokens (estimate)
Delivered as
Prompt text, shown online after purchase

Reviews

Buyers only

No reviews yet. Only buyers of this prompt can leave one.

Report this prompt