跳至橫幅的結尾
前往橫幅的開頭

OpenAPI Plugin

跳至中繼資料的結尾
前往中繼資料的開頭

You are viewing an old version of this content. View the current version.

比較目前 View Version History

版本 1 下一步 »

OpenAPI Type 的Plugin, 使用符合OpenAPI 格式的yaml檔, 只要在Plugin 中,指定你的yaml 的位置, DaVinci 會去這個url 下載yaml檔案, 並且依照裡面的API format 進行API的資訊檢索.
OpenAPI Type Plugin example:

{
  "id": "Weather_API",
  "schema_version": "v1",
  "name_for_human": "Weather_API",
  "name_for_model": "Weather_API",
  "description_for_human": "Weather_API",
  "description_for_model": "當你需要查詢未來天氣的相關資料, 請使用這個API, 並且整理相關資訊以表格輸出",
  "auth": "none",
  "api": {
    "type": "openapi",
    "url": "https://example.com/weather.yaml"
  }
}

這是一個 查詢天氣的範例, 假設我們要使用氣象資料開放平台提供的開源API來索取資料, 需要兩個步驟:

  1. 根據氣象資料開放平台的API範例, 將各API的url 以及參數, 轉換成yaml檔案 並且存放到您的伺服器中

  2. plugin json 檔裡面, 修改這兩個地方

"api": {
    "type": "openapi",
    "url": "https://example.com/weather.yaml"
  }

即可完成Plugin 的製作

  • 無標籤