API endpoint: path और HTTP method मिलकर operation तय करते हैं
API endpoint वह interface है जिससे client API operation बुलाता है। HTTP API में endpoint को केवल URL path से बताना अधूरा है: एक ही path पर GET और PATCH अलग काम और request/response contract रख सकते हैं। OpenAPI 3.2.1 path के साथ उस पर उपलब्ध operations भी दर्ज करता है।
API endpoint वह interface है जिससे client API operation बुलाता है। HTTP API में endpoint को केवल URL path से बताना अधूरा है: एक ही path पर GET और PATCH अलग काम और request/response contract रख सकते हैं। OpenAPI 3.2.1 path के साथ उस पर उपलब्ध operations भी दर्ज करता है।
URL और operation अलग रखें
/orders/{orderId} एक order के लिए path template है; {orderId} ऐसा path parameter है जिसका मान हर request में बदलता है। उसी path पर GET order लाने और PATCH आंशिक बदलाव का contract परिभाषित कर सकता है। पूरा request URL server URL और path से बनता है। Query parameters, headers और request body भी operation contract का हिस्सा हो सकते हैं।
उदाहरण के लिए GET /orders/42 order ला सकता है, PATCH /orders/42 उसे बदल सकता है और GET /orders?status=open छाँटे गए orders दिखा सकता है। ये केवल उदाहरण हैं, किसी live API के दावे नहीं। HTTP semantics को API-specific contract के साथ पढ़ें; एक URL हर method के लिए समान response या अधिकार की गारंटी नहीं देता।
OpenAPI में contract ढूँढें
servers में server URLs और paths में paths तथा operations होते हैं। Path Item में get, post, put, patch आदि लिखे जा सकते हैं। Operation में operationId, parameters, requestBody, responses और security हो सकते हैं। Template का हर {parameter} आवश्यक path-parameter declaration से मेल खाना चाहिए।
समीक्षा में server URL और path का संयुक्त पता, parameter के नाम/प्रकार/सीमाएँ, उपलब्ध methods, query/header/body inputs, media types, response codes और schemas, security settings और exceptions, तथा cache, retry, rate limit और error behavior का दस्तावेज़ीकरण जाँचें।
सही OpenAPI दस्तावेज़ यह साबित नहीं करता कि तैनात server उससे मेल खाता है; implementation और integration जाँच भी चाहिए। दर्ज path हर caller को अधिकार नहीं देता। Authentication और resource permission runtime पर जाँची जानी चाहिए।
आम भ्रम
Path लक्ष्य बताता है; method काम का प्रकार बताता है। task-जैसा path नाम अकेले API की वैधता तय नहीं करता; contract और HTTP semantics देखें। अलग parameter नाम भी एक ही path structure दर्शाकर दस्तावेज़ में टकरा सकते हैं। सुरक्षा नीति, deployment स्थिति या tenant scope दस्तावेज़ित operation को अस्वीकार कर सकते हैं।
स्रोत
[OpenAPI Specification 3.2.1: Paths Object](https://spec.openapis.org/oas/v3.2.1.html#paths-object)
[OpenAPI Specification 3.2.1: Path Item Object](https://spec.openapis.org/oas/v3.2.1.html#path-item-object)
[RFC 9110: HTTP semantics](https://www.rfc-editor.org/rfc/rfc9110.html)