Lingara Lingara 說明文件 學習指南 API 程式庫 App 建立 網頁版
語言: 粵語

攞呢份文件

API 版本 2026-10-affable-towhee

get https://api.getlingara.com/v1/openapi.json

用 JSON 傳回呢份 API 描述,係請求所用嘅 API 版本嘅:Lingara-Version 指明嗰個,唔係就係而家嘅版本。唔需要權杖。

權限範圍 唔需要驗證身份

參數

Lingara-Versionheaderstring選填
回應呢個請求所用嘅 API 版本。冇呢個嘅話,存取權杖會用佢嘅用戶端綁定嘅版本,冇權杖嘅請求會用而家嘅版本。仲喺開發中嘅版本,只可以喺度指明先用到。唔認得嘅版本會回 400,代碼係 api_version_unknown。GET /v1/versions 會列出所有版本。

回應

200 OpenAPI 文件

錯誤

410application/json
回應呢個請求所用嘅 API 版本已經停用。請喺 Lingara-Version 傳一個有支援嘅版本,或者將用戶端綁去另一個版本。
4XXapplication/json
請求被拒絕。code 講出原因,error 用文字解釋。
503application/json · text/plain
服務暫時用唔到;請等 Retry-After 入面嘅秒數之後再試。維護期間,回應內容係純文字,而唔係錯誤封包。
codestring必填

請求被拒絕嘅原因,係一個穩定嘅代碼,可以用嚟做分支處理:例如 insufficient_scope(403)、rate_limited(429),對按用量收費嘅用戶端仲有 spend_cap_reached(402)同 metered_billing_inactive(402)。

errorstring必填

例子

程式碼例子嘅語言

curl

curl "https://api.getlingara.com/v1/openapi.json"

TypeScript

const document = await client.getOpenApiDocument();
console.log(document.servedVersion, Object.keys(document));

Rust

let document = client.get_open_api_document().await?;
let keys: Vec<&String> = document.as_object().map(|o| o.keys().collect()).unwrap_or_default();
println!("{:?} {keys:?}", document.served_version());

Go

doc, err := client.GetOpenAPIDocument(ctx)
if err != nil {
	return err
}
fmt.Println(doc.Value["openapi"], doc.ServedVersion)

Java

import com.fasterxml.jackson.databind.JsonNode;
import com.getlingara.client.LingaraClient;

JsonNode document = client.getOpenApiDocument().body();
System.out.println(document.path("info").path("version").asText());

Kotlin

import com.getlingara.kotlin.LingaraClient
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive

val document = client.getOpenApiDocument().body
println(
    document
        .getValue("info")
        .jsonObject
        .getValue("version")
        .jsonPrimitive.content,
)

Ruby

document = client.get_open_api_document
puts "#{document.value["openapi"]} #{document.served_version}"

PHP

// Needs no token: a client built without credentials can call it.
$document = $client->getOpenApiDocument()->value;
echo $document->info->title, ' ', $document->info->version, "\n";

想用程式庫?睇吓程式庫部分。

如果譯本同英文參考文件有出入,以英文參考文件為準。