Day 4 Task 01 Create an API contract

Task 01. API Contract Generation

By analyzing the contents of the requirements definition and screen definition, the types of request and response fields and English variable names are defined, and a standard API contract is automatically created.

Task 01 API contract creation practice guide

📥 Practice Input

  • day4_meeting_notes.md (meeting minutes)

💾 Practice output (Output)

  • erd-schema.md (Data Specification and ERD)

1. Story and practice background

Once the screen design is completed in a project, front-end and back-end developers must first discuss what data will be exchanged. However, when defining the API at the oral meeting or notepad level, essential data fields are omitted, or the English names and data types (String, Number, Boolean) of the fields are defined differently, so when drawing the actual screen, API communication errors often cause the screen to turn white.

In this exercise, you will learn a workflow that uses Codex to automatically create a standardized API contract that is 100% mapped to the planning intent based on an unstructured planning requirements definition and screen definition, and helps you start development without friction by sharing the same specifications with the front-end and back-end.

2. Learning objectives

  • From the unstructured requirements specification, business actions (endpoints) to be exposed in API form can be derived.
  • You can define a mapping relationship between screen UI components and API Request/Response fields.
  • Using AI, you can quickly build a draft API specification that does not violate RESTful rules.
  • A front/backend specification contract can be signed before development begins.

🛠️Practical guide to follow along

  1. Create file for practice: Click the download button below day4_meeting_notes.md file automation/ Save it within the folder.
  2. Codex Review Delegation: Select the two files and build them by sending the **Codex request prompt** below to the Codex Client prompt input window.
  3. Check API specifications: In the printed statement, check whether the API Endpoint, field name, and JSON Request/Response format, such as `/api/v1/reservations`, are correct.

Download practice materials

Codex request prompt

Task 01 Prompt
Based on the provided requirements definition and screen definition, please derive a list of required APIs and create a standard API contract by defining the types of Request and Response fields and English variable names.

4. Example results

Codex comprehensively analyzes specification data and creates a normalized API contract as shown below.

Entity name Description main properties relationship information
POST /api/v1/reservations General members using counseling services Request: expert_id, reservation_date Reservation and 1:N relationship
Response: 201 Created Partner experts providing consultation expert_id (PK), name, category Reservation and 1:N relationship
GET /api/v1/experts About user-to-expert reservation mapping Request: category (query parameter) N:1 relationship with User/Expert, 1:1 relationship with Payment
Response: 200 OK Payment transaction information to confirm your reservation Response: list of expert objects 1:1 relationship with Reservation

5. AI utilization points

  • Screen-to-data mapping: Automatically identifies backend response fields without omission based on information that should be displayed in screen planning (expert information, date, etc.).
  • RESTful naming: Automatic conversion and type definition of business actions into noun-type endpoint rules and HTTP Methods.