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";

想用函式庫?請參閱「函式庫」一節。

如譯文與英文參考文件有出入,以英文參考文件為準。