Genesis Arbitrage

Genesis Arbitrage · · 3 मिनट में पढ़ें

OpenAPI

OpenAPI (OpenAPI Specification, OAS) HTTP API को machine-readable ढंग से बताने का खुला मानक है: सेवा में कौन-से paths और methods हैं, वे कौन-से parameters लेते हैं, क्या लौटाते हैं और key कैसे भेजनी है। दस्तावेज़ JSON या YAML में लिखा जाता है, और लोग तथा प्रोग्राम, दोनों सोर्स कोड तक पहुँचे बिना उससे API समझ सकते हैं।

मानक कहाँ से आया

यह मानक Swagger Specification से निकला, जो पहली बार 2011 में जारी हुआ। 2015 में Swagger 2.0 को OpenAPI Initiative को दान कर दिया गया, जो Linux Foundation का एक खुला प्रोजेक्ट है, और 2016 से यह specification OpenAPI नाम से विकसित हो रही है। वर्शन 3.0 2017 में और 3.1 फ़रवरी 2021 में आया; सबसे नई लाइन 3.2 है (3.1 specification)।

दस्तावेज़ क्या बताता है

Genesis API spec का संक्षिप्त अंश, funding rates operation और key scheme:

{
  "openapi": "3.1.0",
  "servers": [{ "url": "https://api.genesisarbitrage.com/v1" }],
  "paths": {
    "/funding/rates": {
      "get": {
        "operationId": "getFundingRates",
        "summary": "Funding rates",
        "x-genesis-plans": ["trial", "start", "pro", "max"],
        "parameters": [
          { "name": "coin", "in": "query", "required": false,
            "schema": { "type": "string" } }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": { "type": "apiKey", "in": "header",
                      "name": "X-API-Key" }
    }
  }
}

x- से शुरू होने वाले fields specification extensions हैं: x-genesis-plans उन प्लान की सूची देता है जिनमें यह operation शामिल है।

Spec किस काम आती है

मानक के उपयोगों में documentation बनाना, अलग-अलग भाषाओं में clients और servers बनाना, और testing गिनाए जाते हैं। AI agents के लिए spec तैयार toolset है: operationId, विवरण और parameter schema वाला operation function calling या MCP server के tool से मेल खाता है।

Genesis API में OpenAPI

Genesis API की spec genesisarbitrage.com/openapi.json पर है: OpenAPI 3.1, 37 operations, key X-API-Key header में (authentication)। इसे अपने-आप भी खोजा जा सकता है: genesisarbitrage.com पर /.well-known/api-catalog फ़ाइल, जो RFC 9727 में परिभाषित है, service-desc लिंक से इसकी ओर इशारा करती है। Spec को agent से कैसे जोड़ें, यह AI agents के लिए Genesis API में बताया गया है।

यह भी देखें: REST API, JSON, API endpoint, AI agents के लिए crypto market data।

सवाल और जवाब

क्या Swagger और OpenAPI एक ही चीज़ हैं?

ये एक ही मानक के दो नाम हैं: Swagger Specification 2016 से OpenAPI नाम से विकसित हो रही है। वर्शन 2.0 अब भी Swagger 2.0 नाम से आया था, और 3.0 से यह OpenAPI Specification के रूप में प्रकाशित होती है।

Spec होने पर क्या SDK की ज़रूरत है?

Genesis API के लिए नहीं: हर request एक header वाला GET है, इसलिए कोई भी HTTP client चलता है। Spec से client generate करना तब काम का है जब आप typed methods चाहते हों।