یہ ایک جمعہ کے وقت 4:30 بجے ایک غیر خطرناک Slack پیغام کے طور پر شروع ہوا. "ہاں، frontend کو صارف کی ترجیحات کو ظاہر کرنے کے لئے ایک تیزی سے انٹرفیس کی ضرورت ہے. صرف ڈی بی سے JSON blob واپس کریں. "ہاں، frontend کو صارف کی ترجیحات کو ظاہر کرنے کے لئے ایک تیزی سے انٹرفیس کی ضرورت ہے. صرف ڈی بی سے JSON blob واپس کریں. چھ ماہ بعد، یہ "10 منٹ ختم نقطہ" ایک ماونولیٹک بن گیا ہے یہ 4MB ڈیٹا واپس کرتا ہے، camelCase اور snake_case مکس کرتا ہے، پیجنگ کی ضرورت نہیں ہے، اور ہر بار جب آپ ڈیٹا بیس شیڈم کو ٹچ کرتے ہیں تو آپ کو ایک API ڈیزائن نہیں کیا گیا ہے، آپ نے صرف HTTP پر اپنے ڈیٹا بیس کو ظاہر کیا ہے اور بہترین امید کی ہے. /v1/user/stuff This is the silent killer of modern software scalability. ہم API ڈیزائن کو ایک پس منظر کے طور پر دیکھتے ہیں - ڈیٹا کو A سے B تک پائپ کرنے کے لئے ایک پائپنگ کام. برا API ڈیزائن صرف برے کوڈ نہیں ہے؛ یہ آرکیٹیکل انٹرویا ہے جو ٹیموں کے درمیان توازن کے اخراجات میں اضافہ کرتا ہے. ہے مسئلہ یہ نہیں ہے کہ ہم REST اصولوں کو نہیں جانتے ہیں، ہم جانتے ہیں کہ ہم استعمال کریں بدلنے کے لئے اور ،مزید اپ ڈیٹ کریں ،یہ مسئلہ یہ ہے کہ یہ ایک لائبریری کے تعلیمی اور ایک شہر کے منصوبے کے پیش نظر کی ضرورت ہے. ہونا چاہئے PUT PATCH designing rigorous, standard-compliant APIs is exhausting لیکن اگر آپ ایک سخت، تفصیلی نقطہ نظر کی دعوت کرسکتے ہیں تو کیا ہوگا؟ آپ کو ایک ہی لائن کنٹرولر کوڈ لکھنے سے پہلے ہر راہ کا جائزہ لیں؟ Senior API Architect ’پہلے معاہدے‘ کا مظاہرہ میں نے ایک سسٹم پرومیٹ تیار کیا ہے جو بڑے زبان ماڈلوں (LLMs) کو "کوڈ جنریٹر" ہونے سے روکنے اور "معیار ڈیزائنرز" بننے کے لئے مجبور کرتا ہے. زیادہ تر ڈویلپرز AI سے پوچھتے ہیں: AI ایک فعال لیکن ناخوشگوار کام کرتا ہے. "صارفین کو اپ ڈیٹ کرنے کے لئے ایک Flask راہ لکھیں." اس کے نتیجے میں، آپ کو ایک قدم واپس کرنے کی ضرورت ہے، یہ ایک یہ کوڈ لکھنے سے انکار کرتا ہے جب تک کہ اس نے : وسائل کے ماڈل، HTTP معنی، غلطی کے انتظام کی حکمت عملی، اور سیکورٹی کی پوزیشن. Senior API Architect with 15+ years of experience معاہدے یہ ان کے اعمال کو اس کے علاوہ، آپ کے API کو تلاش، کیچنگ اور یکساں ہے. Richardson Maturity Model Level 3 The Architect's Blueprint Prompt کے مترادفات مندرجہ ذیل ہدایات کے بلاک کو کاپی کریں.آپ کے اگلے نقطہ لکھنے سے پہلے، یہ کوڈ، چیٹ جی پی ٹی، یا جیمنی میں شامل کریں. # 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 1۔ "Resource Model" Shield فوری طور پر تقسیم کیا جاتا ہے سے یہ "RPC-style" URLs کو ڈیزائن کرنے میں عام غلطی کو روکتا ہے جیسے یا ( )۱۰ ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، ، یہ آپ کے API کو سکرپٹ کی ایک مجموعہ سے ایک رجسٹریشن شدہ وسائل کے گراف میں تبدیل کرتا ہے. Resource Design Operation Logic /updateUser /deleteProduct /users/{id} 2۔ "Problem Details" کے معیار زیادہ تر API غلطیوں کو واپس کرتے ہیں جیسے یہ فوری طور پر کام کرتا ہے AI غلطی کے جوابات کو ڈیزائن کرے گا جو شامل ہیں ، ، اور اس کا مطلب یہ ہے کہ آپ کے frontend گاہکوں کو غلطیوں کو پیش کرنے کے بجائے خطوط کا اندازہ کرنے کے لئے پروگرامنگ کرسکتے ہیں. {"error": "Something went wrong"} RFC 7807 (Problem Details for HTTP APIs) type title status detail OpenAPI معاہدے طلب کرنے کے لئے ایک YAML میں، پیداوار صرف دستاویزات نہیں ہے - یہ executable کوڈ ہے. آپ کو کلائنٹ SDKs یا mock سرورز پیدا کرنے کے لئے Swagger ایڈیٹر میں براہ راست نتائج ڈال سکتے ہیں. انضمام شروع ہوتا ہے. OpenAPI 3.0+ specification پہلے Legacy Code کی تعمیر کو روکیں وارث کوڈ کی عمر کی طرف سے مقرر نہیں کیا جاتا ہے؛ یہ ڈیزائن کی کمی کی طرف سے مقرر کیا جاتا ہے. ایک API جو پیش نظر کے بغیر ڈیزائن کیا گیا ہے، اس وقت وارث کوڈ بن جاتا ہے جب یہ پیداوار میں آتا ہے. یہ آپ کے لئے کاروباری منطق نہیں لکھیں گے، لیکن یہ اس بات کو یقینی بنائیں گے کہ آپ کی بنیاد مضبوط، مطابقت، اور پیمائش کے لئے تیار ہے. صرف نقطہ نظر نہ لکھیں. Design contracts.