Subscription - List

列出 API 管理 服務實例的所有訂用帳戶。

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions?api-version=2022-08-01
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions?$filter={$filter}&$top={$top}&$skip={$skip}&api-version=2022-08-01

URI 參數

名稱 位於 必要 類型 Description
resourceGroupName
path True

string

資源群組的名稱。 名稱不區分大小寫。

serviceName
path True

string

API 管理 服務的名稱。

Regex pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$

subscriptionId
path True

string

目標訂用帳戶的標識碼。

api-version
query True

string

用於此作業的 API 版本。

$filter
query

string

|欄位 |使用量 |支持的運算子 |支援的函式 |
|-------------|-------------|-------------|-------------|
|name |filter |ge, le, eq, ne, gt, lt |substringof, contains, startswith, endswith |
|displayName |filter |ge, le, eq, ne, gt, lt |substringof, contains, startswith, endswith |
|stateComment |filter |ge, le, eq, ne, gt, lt |substringof, contains, startswith, endswith |
|ownerId |filter |ge, le, eq, ne, gt, lt |substringof, contains, startswith, endswith |
|scope |filter |ge, le, eq, ne, gt, lt |substringof, contains, startswith, endswith |
|userId |filter |ge, le, eq, ne, gt, lt |substringof, contains, startswith, endswith |
|productId |filter |ge, le, eq, ne, gt, lt |substringof, contains, startswith, endswith |
|state |filter |eq | |
|user |expand | | | |

$skip
query

integer

int32

要略過的記錄數目。

$top
query

integer

int32

要傳回的記錄數目。

回應

名稱 類型 Description
200 OK

SubscriptionCollection

指定之 API 管理 服務實例的訂用帳戶實體集合。

Other Status Codes

ErrorResponse

描述作業失敗原因的錯誤回應。

安全性

azure_auth

Azure Active Directory OAuth2 Flow。

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名稱 Description
user_impersonation 模擬您的用戶帳戶

範例

ApiManagementListSubscriptions

Sample Request

GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/subscriptions?api-version=2022-08-01

Sample Response

{
  "value": [
    {
      "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/subscriptions/5600b59475ff190048070001",
      "type": "Microsoft.ApiManagement/service/subscriptions",
      "name": "5600b59475ff190048070001",
      "properties": {
        "ownerId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1",
        "scope": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060001",
        "state": "active",
        "createdDate": "2015-09-22T01:57:40.3Z"
      }
    },
    {
      "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/subscriptions/56eaed3dbaf08b06e46d27fe",
      "type": "Microsoft.ApiManagement/service/subscriptions",
      "name": "56eaed3dbaf08b06e46d27fe",
      "properties": {
        "ownerId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/56eaec62baf08b06e46d27fd",
        "scope": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060001",
        "displayName": "Starter",
        "state": "active",
        "createdDate": "2016-03-17T17:45:33.837Z",
        "startDate": "2016-03-17T00:00:00Z",
        "expirationDate": "2016-04-01T00:00:00Z",
        "notificationDate": "2016-03-20T00:00:00Z"
      }
    },
    {
      "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/subscriptions/5931a769d8d14f0ad8ce13b8",
      "type": "Microsoft.ApiManagement/service/subscriptions",
      "name": "5931a769d8d14f0ad8ce13b8",
      "properties": {
        "ownerId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/5931a75ae4bbd512a88c680b",
        "scope": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060002",
        "displayName": "Unlimited",
        "state": "submitted",
        "createdDate": "2017-06-02T17:59:06.223Z"
      }
    }
  ],
  "count": 3,
  "nextLink": ""
}

定義

名稱 Description
ErrorFieldContract

錯誤欄位合約。

ErrorResponse

錯誤回應。

SubscriptionCollection

分頁訂閱清單表示法。

SubscriptionContract

訂用帳戶詳細數據。

SubscriptionState

訂用帳戶狀態。 可能的狀態為 * 作用中 – 訂用帳戶為作用中、* 暫停 – 訂用帳戶遭到封鎖,且訂閱者無法呼叫產品的任何 API* 已提交 – 開發人員已提出訂閱要求,但尚未核准或拒絕,* 已拒絕 – 系統管理員已拒絕訂閱要求、* 已取消 – 開發人員或系統管理員已取消訂閱要求。 * 已過期 – 訂閱已達到到期日,且已停用。

ErrorFieldContract

錯誤欄位合約。

名稱 類型 Description
code

string

屬性層級錯誤碼。

message

string

人類可讀取的屬性層級錯誤表示法。

target

string

屬性名稱。

ErrorResponse

錯誤回應。

名稱 類型 Description
error.code

string

服務定義的錯誤碼。 此代碼會作為回應中指定之 HTTP 錯誤碼的子狀態。

error.details

ErrorFieldContract[]

在驗證錯誤時,要求中傳送的無效欄位清單。

error.message

string

人類可閱讀的錯誤表示法。

SubscriptionCollection

分頁訂閱清單表示法。

名稱 類型 Description
count

integer

所有頁面的總記錄計數數目。

nextLink

string

如果有的話,下一頁連結。

value

SubscriptionContract[]

頁面值。

SubscriptionContract

訂用帳戶詳細數據。

名稱 類型 Description
id

string

資源的完整資源識別碼。 例如 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

資源的名稱

properties.allowTracing

boolean

判斷是否啟用追蹤

properties.createdDate

string

訂閱建立日期。 日期符合下列格式: yyyy-MM-ddTHH:mm:ssZ 如 ISO 8601 標準所指定。

properties.displayName

string

訂用帳戶的名稱,如果訂用帳戶沒有名稱,則為 null。

properties.endDate

string

訂閱取消或過期的日期。 此設定僅供稽核之用,且不會自動取消訂閱。 訂用 state 帳戶生命週期可以使用 屬性來管理。 日期符合下列格式: yyyy-MM-ddTHH:mm:ssZ 如 ISO 8601 標準所指定。

properties.expirationDate

string

訂閱到期日。 此設定僅供稽核之用,且訂用帳戶不會自動過期。 訂用 state 帳戶生命週期可以使用 屬性來管理。 日期符合下列格式: yyyy-MM-ddTHH:mm:ssZ 如 ISO 8601 標準所指定。

properties.notificationDate

string

即將推出的訂閱到期通知日期。 日期符合下列格式: yyyy-MM-ddTHH:mm:ssZ 如 ISO 8601 標準所指定。

properties.ownerId

string

訂閱擁有者的使用者資源識別碼。 此值是 /users/{userId} 格式的有效相對 URL,其中 {userId} 是使用者標識符。

properties.primaryKey

string

訂用帳戶主鍵。 此屬性不會填入 『GET』 作業! 使用 '/listSecrets' POST 要求來取得值。

properties.scope

string

範圍,例如 /products/{productId} 或 /apis 或 /apis/{apiId}。

properties.secondaryKey

string

訂用帳戶次要金鑰。 此屬性不會填入 『GET』 作業! 使用 '/listSecrets' POST 要求來取得值。

properties.startDate

string

訂閱啟用日期。 此設定僅供稽核之用,且不會自動啟用訂閱。 訂用 state 帳戶生命週期可以使用 屬性來管理。 日期符合下列格式: yyyy-MM-ddTHH:mm:ssZ 如 ISO 8601 標準所指定。

properties.state

SubscriptionState

訂用帳戶狀態。 可能的狀態為 * 作用中 – 訂用帳戶為作用中、* 暫停 – 訂用帳戶遭到封鎖,且訂閱者無法呼叫產品的任何 API* 已提交 – 開發人員已提出訂閱要求,但尚未核准或拒絕,* 已拒絕 – 系統管理員已拒絕訂閱要求、* 已取消 – 開發人員或系統管理員已取消訂閱要求。 * 已過期 – 訂閱已達到到期日,且已停用。

properties.stateComment

string

當狀態變更為「已拒絕」時,系統管理員新增的選擇性訂用帳戶批注。

type

string

資源類型。 例如“Microsoft.Compute/virtualMachines” 或 “Microsoft.Storage/storageAccounts”

SubscriptionState

訂用帳戶狀態。 可能的狀態為 * 作用中 – 訂用帳戶為作用中、* 暫停 – 訂用帳戶遭到封鎖,且訂閱者無法呼叫產品的任何 API* 已提交 – 開發人員已提出訂閱要求,但尚未核准或拒絕,* 已拒絕 – 系統管理員已拒絕訂閱要求、* 已取消 – 開發人員或系統管理員已取消訂閱要求。 * 已過期 – 訂閱已達到到期日,且已停用。

名稱 類型 Description
active

string

cancelled

string

expired

string

rejected

string

submitted

string

suspended

string