Task 01 API Contract Generation Lab Guide
📥 Lab input
- •
day4_meeting_notes.md(meeting notes)
💾 Lab output
- •
erd-schema.md(data spec and ERD)
1. Story and lab background
When screen design is done, front-end and back-end developers must first agree on what data they'll exchange. But when APIs are defined only in spoken meetings or notepads, needed fields go missing, or each side defines field names and data types (String, Number, Boolean) differently — and when building the real screen, API errors freeze the screen white.
In this lab, you'll learn a workflow that uses Codex to automatically generate a standardized API Contract that maps 100% to the planning intent from unstructured requirements and screen specs, so front end and back end share the same format and start development without friction.
2. Learning goals
- Derive the business actions (Endpoints) to expose as APIs from unstructured requirement specs.
- Define the mapping between screen UI components and API Request/Response fields.
- Use AI to quickly build a draft API spec that follows RESTful rules.
- Make a front-end/back-end format contract before development starts.
🛠️ Follow-along lab guide
- Create the lab file: press the download button below and save
day4_meeting_notes.mdin theautomation/folder. - Hand the review to Codex: select the two files, send the **Codex request prompt** below in the Codex Client prompt box and build.
- Check the API format: review whether the API Endpoints like `/api/v1/reservations`, field names and JSON Request/Response shapes are right.
Download lab materials
Codex request prompt
Task 01 Prompt
Based on the provided requirements doc and screen spec, list the APIs needed, define the types and English variable names of Request and Response fields, and write a standard API Contract.
4. Example output
Codex analyzes the spec data together and writes a normalized API contract like below.
| Entity | Explanation | Main attributes | Relationships |
|---|---|---|---|
| POST /api/v1/reservations | Regular member who uses the consultation service | Request: expert_id, reservation_date | 1:N with Reservation |
| Response: 201 Created | Partner expert who gives consultations | expert_id (PK), name, category | 1:N with Reservation |
| GET /api/v1/experts | Booking mapping between user and expert | Request: category (query parameter) | N:1 with User/Expert, 1:1 with Payment |
| Response: 200 OK | Payment transaction info to confirm the booking | Response: list of expert objects | 1:1 with Reservation |
5. AI use points
- Screen-data mapping: automatically identifies every back-end response field based on what the screen plan must show (expert info, date, etc.).
- RESTful naming: automatically converts business actions into noun-based endpoint rules and HTTP Methods, and defines types.