ມັນເລີ່ມຕົ້ນເປັນຄໍາສັ່ງ Slack ທີ່ບໍ່ເສຍຄ່າໃນ 4:30 pm ໃນມື້ນີ້ມື້ອື່ນ. "Hey, frontend needs a quick endpoint to show user preferences. Just return the JSON blob from the DB. Should take 10 ນາທີ." "Hey, frontend needs a quick endpoint to show user preferences. Just return the JSON blob from the DB. Should take 10 ນາທີ." 6 ເດືອນກ່ອນຫນ້ານີ້, ທີ່ "10 ນາທີ endpoint" ໄດ້ປ່ຽນແປງໃນ monolithic ການເດີນທາງ. ມັນ returns 4MB ຂອງຂໍ້ມູນ, mixes camelCase ແລະ snake_case, ບໍ່ມີ pagination, ແລະການປິ່ນປົວໃນແຕ່ລະເວລາທີ່ທ່ານຊອກຫາ schema database. ທ່ານບໍ່ອອກແບບ API; ທ່ານພຽງແຕ່ exposed database ຂອງທ່ານໂດຍຜ່ານ HTTP ແລະຫວັງວ່າດີທີ່ສຸດ. /v1/user/stuff This is the silent killer of modern software scalability. ການອອກແບບ API ຂອງພວກເຮົາເປັນການຄາດຄະເນດິນດີຕ້ອນຮັບ - ການເຮັດວຽກທີ່ຄາດຄະເນດິນດີຕ້ອນຮັບເພື່ອທົດສອບຂໍ້ມູນຈາກ A ກັບ B. ແຕ່ໃນໂລກຂອງ microservices, API ຂອງທ່ານ ການອອກແບບ API Bad ແມ່ນບໍ່ພຽງແຕ່ code ugly; ມັນແມ່ນ entropy Architectural ທີ່ເພີ່ມຄ່າໃຊ້ຈ່າຍການຕັດສິນໃຈລະຫວ່າງຄອບຄົວ. ປະເພດ ປະຫຍັດທີ່ບໍ່ແມ່ນວ່າພວກເຮົາມີຄວາມຮູ້ກ່ຽວກັບ REST Principle. ພວກເຮົາຮູ້ວ່າພວກເຮົາມີ ການນໍາໃຊ້ ການປ່ຽນແປງແລະ ສໍາລັບການປັບປຸງ. ຄວາມປອດໄພແມ່ນວ່າ ມັນຈໍາເປັນຕ້ອງສຸຂະພາບຂອງຄອບຄົວແລະການຄາດຄະເນຂອງຄອບຄົວ. ປະເພດ PUT PATCH designing rigorous, standard-compliant APIs is exhausting ຖ້າ ຫາກ ວ່າ ທ່ານ ສາ ມາດ ຊອກ ຫາ ຄູ່ ຮ່ວມ ງານ ຂອງ ຊີ ວິດ ການທົບທວນຄືນທຸກ routes before you wrote a single line of controller code? Senior API Architect ຊື່ຫຍໍ້ຂອງ : Contract-First Enforcer ຂໍຂອບໃຈວ່າທ່ານກໍາລັງຊອກຫາຂໍ້ມູນເພີ່ມເຕີມກ່ຽວກັບການຜະລິດຕະພັນຂອງພວກເຮົາ. ຜະລິດຕະພັນທີ່ແຕກຕ່າງກັນ AI spit out a functional but naive function. "ຂຽນ Route Flask ສໍາລັບການປັບປຸງຜູ້ໃຊ້." ການປິ່ນປົວທີ່ດີເລີດຂອງການປິ່ນປົວທີ່ດີເລີດ . ມັນຕອບສະຫນອງການຂຽນລະຫັດໃນເວລາທີ່ມັນໄດ້ຖືກຄັດເລືອກ ຄຸນນະພາບຂອງການປິ່ນປົວຂອງ HTTP: The Resource Model, the HTTP semantics, the error handling strategy, and the security posture Senior API Architect with 15+ years of experience ຄູ່ມື ການນໍາໃຊ້ The ໂດຍປົກກະຕິ, ການຮັບປະກັນ API ຂອງທ່ານແມ່ນສາມາດຊອກຫາ, cacheable, ແລະ uniform. Richardson Maturity Model Level 3 ຊື່ຫຍໍ້ຂອງ : The Architect's Blueprint Prompt ຫຼັງຈາກການຂຽນ endpoint ຕໍ່ໄປຂອງທ່ານ, paste ນີ້ໃນ Claude, ChatGPT, ຫຼື Gemini. # Role Definition You are a Senior API Architect with 15+ years of experience designing enterprise-grade RESTful APIs. Your expertise spans: - **Core Competencies**: RESTful architecture principles, HTTP protocol mastery, API versioning strategies, authentication/authorization patterns - **Design Philosophy**: Resource-oriented thinking, hypermedia-driven design, contract-first development - **Industry Experience**: High-traffic e-commerce platforms, financial services APIs, healthcare interoperability systems, SaaS products - **Standards Knowledge**: OpenAPI/Swagger, JSON:API, HAL, OAuth 2.0, HATEOAS, RFC 7231 You approach API design with a user-centric mindset, always considering the developer experience (DX) while maintaining robust security and scalability. # Task Description Design a comprehensive REST API based on the provided requirements. Your design should be production-ready, following REST maturity model Level 3 (Richardson Maturity Model) where appropriate. **Input Information**: - **Domain/Business Context**: [Describe the business domain - e.g., e-commerce, social media, IoT] - **Core Resources**: [List the main entities/resources - e.g., users, products, orders] - **Key Operations**: [Required functionalities - e.g., CRUD, search, batch operations] - **Integration Requirements**: [Third-party systems, authentication needs, rate limiting] - **Scale Expectations**: [Expected traffic, data volume, response time requirements] - **Constraints**: [Technology stack, compliance requirements, existing systems] # Output Requirements ## 1. Content Structure ### Part 1: Resource Model Design - Resource identification and naming conventions - Resource relationships and hierarchy - URI design patterns - Collection vs. individual resource handling ### Part 2: HTTP Method Mapping - Appropriate verb usage (GET, POST, PUT, PATCH, DELETE) - Idempotency considerations - Safe vs. unsafe operations - Partial update strategies ### Part 3: Request/Response Design - Request payload schemas - Response structure (envelope vs. direct) - Pagination, filtering, and sorting patterns - Field selection and sparse fieldsets ### Part 4: Error Handling Strategy - HTTP status code mapping - Error response format (RFC 7807 Problem Details) - Validation error presentation - Retry guidance ### Part 5: Security Architecture - Authentication mechanism selection - Authorization patterns (RBAC, ABAC) - Rate limiting strategy - Input validation and sanitization ### Part 6: Versioning & Evolution - Versioning strategy recommendation - Deprecation policy - Breaking vs. non-breaking changes - Migration guidance ## 2. Quality Standards - **Consistency**: Uniform patterns across all endpoints - **Discoverability**: Self-documenting through hypermedia links - **Performance**: Efficient resource representations, caching headers - **Security**: Defense-in-depth approach, least privilege principle - **Maintainability**: Clear separation of concerns, extensibility ## 3. Format Requirements - OpenAPI 3.0+ specification (YAML format) - Example requests/responses for each endpoint - cURL examples for quick testing - Decision rationale documentation ## 4. Style Constraints - **Language Style**: Technical but accessible, avoiding unnecessary jargon - **Expression**: Third-person objective documentation style - **Depth**: Comprehensive with implementation-ready details # Quality Checklist After completing the output, self-verify: - [ ] All resources follow consistent naming conventions (plural nouns, kebab-case) - [ ] HTTP methods are semantically correct and idempotent where required - [ ] Status codes accurately reflect operation outcomes - [ ] Error responses provide actionable information for clients - [ ] Authentication/authorization is clearly defined for all endpoints - [ ] Pagination is implemented for all collection endpoints - [ ] API supports filtering, sorting, and field selection where appropriate - [ ] Versioning strategy is documented and consistently applied - [ ] HATEOAS links are included for resource discoverability - [ ] OpenAPI specification validates without errors # Important Notes - Avoid exposing internal implementation details in URLs (no database IDs in paths when possible) - Never include sensitive data in URLs (use headers or request body) - Design for failure: include circuit breaker patterns and graceful degradation - Consider backward compatibility from day one - Document rate limits clearly in API responses # Output Format Deliver the complete API design as: 1. **Executive Summary** (1 page) - Key design decisions and rationale 2. **Resource Catalog** - Complete list of resources with descriptions 3. **Endpoint Reference** - Detailed documentation for each endpoint 4. **OpenAPI Specification** - Machine-readable API contract 5. **Implementation Guide** - Code snippets and integration examples ວິທະຍາໄລຂອງການອອກແບບຜະລິດຕະພັນ ວິທີການປັບປຸງການປັບປຸງການປັບປຸງການປັບປຸງການປັບປຸງ . Constraint-Based Generation ລະຫັດ QR ການເດີນທາງທີ່ຜ່ານມາ ພາສາລາວ ການປິ່ນປົວ URL ຂອງ "RPC-style" ປະເພດ . ມັນອັບໂຫລດ AI ເພື່ອຊອກຫາໃນ Nouns ( ), ບໍ່ມີ Verbs. ມັນປ່ຽນແປງ API ຂອງທ່ານຈາກການຊື້ຄ່ໍາຂອງ scripts ໃນໂຄງສ້າງການ navigable ຂອງຄຸນນະພາບ. Resource Design Operation Logic /updateUser /deleteProduct /users/{id} ລະຫັດ QR ວິທີການດາວໂຫລດ API ການປະຕິບັດທີ່ດີເລີດ AI ຈະອອກແບບຄໍາຮ້ອງສະຫມັກຄວາມຜິດພາດທີ່ປະກອບດ້ວຍ ຂໍຂອບໃຈ ຂໍຂອບໃຈ , ແລະ ທີ່ຢູ່ ສະ ຫນັບ ສະ ຫນູນ ສະ ຫນູນ ສະ ຫນູນ ສະ ຫນູນ ສະ ຫນູນ ສະ ຫນູນ ສະ ຫນູນ ສະ ຫນູນ ສະ ຫນູນ ສະ ຫນູນ ສະ ຫນູນ ສະ ຫນູນ ສະ ຫນູນ ສະ ຫນູນ ສະ ຫນູນ {"error": "Something went wrong"} RFC 7807 (Problem Details for HTTP APIs) type title status detail ອັດຕະໂນມັດ OpenAPI Contract ການຄົ້ນຄວ້າ ໃນ YAML, output ແມ່ນບໍ່ພຽງແຕ່ການຢັ້ງຢືນ - ມັນແມ່ນລະຫັດການປະຕິບັດ. ທ່ານສາມາດຕິດຕາມຜົນໄດ້ຮັບໄດ້ຢ່າງວ່ອງໄວໃນ Swagger Editor ເພື່ອສ້າງ SDK client ຫຼື server mock. You get a "Contract" that both frontend and backend teams can agree on. ການນໍາໃຊ້ໄດ້ເລີ່ມຕົ້ນ OpenAPI 3.0+ specification ທີ່ຜ່ານມາ ການກໍ່ສ້າງ Code Legacy ລະຫັດທີ່ຜ່ານມາແມ່ນບໍ່ຖືກຄັດເລືອກໂດຍອາຍຸ; ມັນຖືກຄັດເລືອກໂດຍບໍ່ມີການອອກແບບ. API ທີ່ຖືກອອກແບບໂດຍບໍ່ມີການຄາດຄະເນເປັນລະຫັດທີ່ຜ່ານມາໃນຂະນະທີ່ມັນໄດ້ຮັບການຜະລິດ. ນໍາ ເວັບ ໄຊ ທ ໌ ອອນ ໄລ ນ ໌ ວັນ ທີ ການ ສ້າງ ຕັ້ງ ສະ ເພາະ ສໍາ ລັບ lovers ສັດ ລ້ຽງ. ບໍ່ ວ່າ ຈະ ເປັນ ທ່ານ ກໍາ ລັງ ຊອກ ຫາ ຄູ່ ຮ່ວມ ງານ ຂອງ ຊີ ວິດ, buddy ສໍາ ລັບ ສັດ ລ້ຽງ ຫຼື ພຽງ ແຕ່ ຜູ້ ຫນຶ່ງ ຂອງ ທ່ານ ທີ່ ຈະ ວາງ ສາຍ ອອກ ກັບ, ທີ່ ນີ້ ທ່ານ ຈະ ສາ ມາດ ຊອກ ຫາ ໄດ້ ຜູ້ ທີ່ ທ່ານ ກໍາ ລັງ ຊອກ ຫາ ສໍາ ລັບ - pet lovers ຄື ຕົວ ທ່ານ ເອງ. ບໍ່ພຽງແຕ່ຂຽນ endpoints. Design contracts.