az apic api
Note
此參考是 Azure CLI 的 apic-extension 延伸 模組的一部分(2.57.0 版或更高版本)。 擴充功能會在您第一次執行 az apic api 命令時自動安裝
在 API 中心管理 API 的命令。
命令
| 名稱 | Description | 類型 | 狀態 |
|---|---|---|---|
| az apic api create |
註冊新的 API 或更新現有的 API。 |
Extension | GA |
| az apic api definition |
在 API 中心管理 API 定義的命令。 |
Extension | GA |
| az apic api definition create |
建立新的 API 定義或更新現有的 API 定義。 |
Extension | GA |
| az apic api definition delete |
刪除指定的 API 定義。 |
Extension | GA |
| az apic api definition export-specification |
匯出 API 規格。 |
Extension | GA |
| az apic api definition import-specification |
匯入 API 規格。 |
Extension | GA |
| az apic api definition list |
列出 API 定義的集合。 |
Extension | GA |
| az apic api definition show |
取得 API 定義的詳細數據。 |
Extension | GA |
| az apic api definition update |
更新現有的 API 定義。 |
Extension | GA |
| az apic api delete |
刪除指定的 API。 |
Extension | GA |
| az apic api deployment |
在 API 中心管理 API 部署的命令。 |
Extension | GA |
| az apic api deployment create |
建立新的 API 部署或更新現有的 API 部署。 |
Extension | GA |
| az apic api deployment delete |
刪除 API 部署。 |
Extension | GA |
| az apic api deployment list |
列出 API 部署的集合。 |
Extension | GA |
| az apic api deployment show |
取得 API 部署的詳細數據。 |
Extension | GA |
| az apic api deployment update |
更新現有的 API 部署。 |
Extension | GA |
| az apic api list |
列出 API 的集合。 |
Extension | GA |
| az apic api register |
使用規格檔案作為事實來源,向版本、定義和相關聯的部署註冊新的 API。 目前我們只支援 OpenAPI JSON/YAML 格式。 |
Extension | Preview |
| az apic api show |
取得 API 的詳細數據。 |
Extension | GA |
| az apic api update |
更新現有的 API。 |
Extension | GA |
| az apic api version |
在 API 中心管理 API 版本的命令。 |
Extension | GA |
| az apic api version create |
建立新的 API 版本或更新現有的 API 版本。 |
Extension | GA |
| az apic api version delete |
刪除指定的 API 版本。 |
Extension | GA |
| az apic api version list |
列出 API 版本的集合。 |
Extension | GA |
| az apic api version show |
取得 API 版本的詳細數據。 |
Extension | GA |
| az apic api version update |
更新現有的 API 版本。 |
Extension | GA |
az apic api create
註冊新的 API 或更新現有的 API。
az apic api create --api-id
--resource-group
--service-name
--title
--type {graphql, grpc, rest, soap, webhook, websocket}
[--contacts]
[--custom-properties]
[--description]
[--external-documentation]
[--license]
[--summary]
範例
建立 API
az apic api create -g contoso-resources -n contoso --api-id echo-api --title "Echo API" --type REST
使用自訂屬性建立 API
az apic api create -g contoso-resources -n contoso --api-id echo-api --title "Echo API" --type REST --custom-properties '{"public-facing":true}'
使用 json 檔案建立具有自定義屬性的 API
az apic api create -g contoso-resources -n contoso --api-id echo-api --title "Echo API" --type REST --custom-properties '@customProperties.json'
必要參數
API 的識別碼。
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
Azure API 中心服務的名稱。
API 標題。
| 屬性 | 值 |
|---|---|
| 參數群組: | Properties Arguments |
API 的類型。
| 屬性 | 值 |
|---|---|
| 參數群組: | Properties Arguments |
| 接受的值: | graphql, grpc, rest, soap, webhook, websocket |
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
API 的連絡資訊。 支援速記語法、json-file 和 yaml-file。 請嘗試 “??” 以顯示更多。
| 屬性 | 值 |
|---|---|
| 參數群組: | Properties Arguments |
針對 API 目錄實體定義的自訂元數據。 支援速記語法、json-file 和 yaml-file。 請嘗試 “??” 以顯示更多。
| 屬性 | 值 |
|---|---|
| 參數群組: | Properties Arguments |
API 的描述。
| 屬性 | 值 |
|---|---|
| 參數群組: | Properties Arguments |
API 的其他外部檔。 支援速記語法、json-file 和 yaml-file。 請嘗試 “??” 以顯示更多。
| 屬性 | 值 |
|---|---|
| 參數群組: | Properties Arguments |
API 的授權資訊。 支援速記語法、json-file 和 yaml-file。 請嘗試 “??” 以顯示更多。
| 屬性 | 值 |
|---|---|
| 參數群組: | Properties Arguments |
API 的簡短描述。
| 屬性 | 值 |
|---|---|
| 參數群組: | Properties Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az apic api delete
刪除指定的 API。
az apic api delete [--api-id]
[--ids]
[--resource-group]
[--service-name]
[--subscription]
[--yes]
範例
刪除 API
az apic api delete -g contoso-resources -n contoso --api-id echo-api
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
API 的識別碼。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
Azure API 中心服務的名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
請勿提示確認。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az apic api list
列出 API 的集合。
az apic api list --resource-group
--service-name
[--filter]
[--max-items]
[--next-token]
範例
列出 API
az apic api list -g contoso-resources -n contoso
列出具有篩選條件的 API
az apic api list -g contoso-resources -n contoso --filter "kind eq 'rest'"
必要參數
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
Azure API 中心服務的名稱。
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
OData 篩選參數。
命令輸出中要傳回的項目總數。 如果可用的專案總數超過指定的值,則會在命令的輸出中提供令牌。 若要繼續分頁,請在後續命令的 --next-token 自變數中提供令牌值。
| 屬性 | 值 |
|---|---|
| 參數群組: | Pagination Arguments |
標記,指定要開始分頁的位置。 這是先前截斷回應中的令牌值。
| 屬性 | 值 |
|---|---|
| 參數群組: | Pagination Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az apic api register
此命令處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus
使用規格檔案作為事實來源,向版本、定義和相關聯的部署註冊新的 API。 目前我們只支援 OpenAPI JSON/YAML 格式。
az apic api register --api-location
--resource-group
--service-name
[--environment-id]
範例
藉由提供規格檔案來註冊 API。
az apic api register -g api-center-test -n contosoeuap --api-location "examples/cli-examples/spec-examples/openai.json" --environment-id public
az apic api register -g api-center-test -n contosoeuap --api-location "examples/cli-examples/spec-examples/openai.yml" --environment-id public
藉由提供規格 URL 來註冊 API。
az apic api register -g api-center-test -n contosoeuap --api-location "https://petstore.swagger.io/v2/swagger.json" --environment-id public
az apic api register -g api-center-test -n contosoeuap --api-location "https://petstore.swagger.io/v2/swagger.yaml" --environment-id public
必要參數
規格檔案的位置。
資源組名。
APICenter 目錄或服務名稱。
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
之前建立的環境標識碼。
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az apic api show
取得 API 的詳細數據。
az apic api show [--api-id]
[--ids]
[--resource-group]
[--service-name]
[--subscription]
範例
顯示 API 詳細數據
az apic api show -g contoso-resources -n contoso --api-id echo-api
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
API 的識別碼。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
Azure API 中心服務的名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az apic api update
更新現有的 API。
az apic api update [--add]
[--api-id]
[--contacts]
[--custom-properties]
[--description]
[--external-documentation]
[--force-string {0, 1, f, false, n, no, t, true, y, yes}]
[--ids]
[--license]
[--remove]
[--resource-group]
[--service-name]
[--set]
[--subscription]
[--summary]
[--title]
[--type {graphql, grpc, rest, soap, webhook, websocket}]
範例
更新 API
az apic api update -g contoso-resources -n contoso --api-id echo-api --summary "Basic REST API service"
更新自訂屬性
az apic api update -g contoso-resources -n contoso --api-id echo-api --custom-properties '{"public-facing":true}'
使用 json 檔案更新自定義屬性
az apic api update -g contoso-resources -n contoso --api-id echo-api --custom-properties '@customProperities.json'
更新單一自定義元數據
az apic api update -g contoso-resources -n contoso --api-id echo-api --set customProperties.internal=false
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
藉由指定路徑和索引鍵值組,將物件加入物件清單。 範例: --add property.listProperty <key=value, string or JSON string>.
| 屬性 | 值 |
|---|---|
| 參數群組: | Generic Update Arguments |
API 的識別碼。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
API 的連絡資訊。 支援速記語法、json-file 和 yaml-file。 請嘗試 “??” 以顯示更多。
| 屬性 | 值 |
|---|---|
| 參數群組: | Properties Arguments |
針對 API 目錄實體定義的自訂元數據。 支援速記語法、json-file 和 yaml-file。 請嘗試 “??” 以顯示更多。
| 屬性 | 值 |
|---|---|
| 參數群組: | Properties Arguments |
API 的描述。
| 屬性 | 值 |
|---|---|
| 參數群組: | Properties Arguments |
API 的其他外部檔。 支援速記語法、json-file 和 yaml-file。 請嘗試 “??” 以顯示更多。
| 屬性 | 值 |
|---|---|
| 參數群組: | Properties Arguments |
使用 'set' 或 'add' 時,請保留字串常值,而不是嘗試轉換成 JSON。
| 屬性 | 值 |
|---|---|
| 參數群組: | Generic Update Arguments |
| 接受的值: | 0, 1, f, false, n, no, t, true, y, yes |
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
API 的授權資訊。 支援速記語法、json-file 和 yaml-file。 請嘗試 “??” 以顯示更多。
| 屬性 | 值 |
|---|---|
| 參數群組: | Properties Arguments |
從清單中移除屬性或專案。 範例: --remove property.list <indexToRemove> 或 --remove propertyToRemove。
| 屬性 | 值 |
|---|---|
| 參數群組: | Generic Update Arguments |
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
Azure API 中心服務的名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
指定要設定的屬性路徑和值,以更新物件。 範例: --set property1.property2=<value>.
| 屬性 | 值 |
|---|---|
| 參數群組: | Generic Update Arguments |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
API 的簡短描述。
| 屬性 | 值 |
|---|---|
| 參數群組: | Properties Arguments |
API 標題。
| 屬性 | 值 |
|---|---|
| 參數群組: | Properties Arguments |
API 的類型。
| 屬性 | 值 |
|---|---|
| 參數群組: | Properties Arguments |
| 接受的值: | graphql, grpc, rest, soap, webhook, websocket |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |