顧客のサブスクリプションを取得する

適用対象: パートナー センター | 21Vianet が運営するパートナー センター | Microsoft Cloud for US Government のパートナー センター

顧客のサブスクリプションのコレクションを取得する方法。

前提条件

  • パートナー センターの認証に関するページで説明している資格情報。 このシナリオでは、スタンドアロンの App と App+User の両方の資格情報を使用した認証がサポートされています。

  • 顧客 ID です (customer-tenant-id)。 顧客の ID がわからない場合は、[顧客] ワークスペースを選択し、顧客の一覧から顧客を選択し、[アカウント] を選択して、パートナー センター検索できます。 顧客の [アカウント] ページで、[顧客アカウント情報] セクションで Microsoft ID をします。 Microsoft ID は、顧客 ID (customer-tenant-id) と同じです。

C#

顧客のすべてのサブスクリプションの一覧を取得するには、まず、顧客 ID を指定して IAggregatePartner.Customers.ById メソッドを使用して顧客を識別します。 次に、 Subscriptions プロパティを 使用して、サブスクリプション コレクション操作のインターフェイスを取得します。 最後に、Get メソッドまたは GetAsync メソッドを呼び出して、顧客のサブスクリプション コレクションを取得します。

// IAggregatePartner partnerOperations;
// string customerId;

var customerSubscriptions = partnerOperations.Customers.ById(customerId).Subscriptions.Get();

サンプル: コンソール テスト アプリプロジェクト: パートナー センター SDK サンプル クラス: GetSubscriptions.cs

REST 要求

要求の構文

認証方法 要求 URI
GET {baseURL}/v1/customers/{customer-tenant-id}/subscriptions HTTP/1.1

URI パラメーター

次の表に、すべてのサブスクリプションを取得するために必要なクエリ パラメーターを示します。

名前 Required 説明
customer-tenant-id string はい 顧客を識別する GUID 形式の文字列。

要求ヘッダー

詳細については、「パートナー センター REST ヘッダー」を参照してください。

要求本文

なし。

要求の例

GET https://api.partnercenter.microsoft.com/v1/customers/<customer-tenant-id>/subscriptions HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: b2d13828-2ca5-41d4-94fb-9946214f4244
MS-CorrelationId: c49004b1-224f-4d86-a607-6c8bcc52cfdd
Connection: Keep-Alive

REST 応答

成功した場合、このメソッドは応答本文でサブスクリプション リソースのコレクションを返します。

応答の成功とエラーのコード

各応答には、成功または失敗を示す HTTP ステータス コードと、追加のデバッグ情報が付属しています。 このコード、エラーの種類、追加のパラメーターを読み取るには、ネットワーク トレース ツールを使用します。 完全な一覧については、パートナー センターの REST エラーコードに関する記事を参照してください。

応答例

レガシ オンライン サービス サブスクリプションの応答の例

HTTP/1.1 200 OK
Content-Length: 73754
Content-Type: application/json
MS-CorrelationId: c49004b1-224f-4d86-a607-6c8bcc52cfdd
MS-RequestId: b2d13828-2ca5-41d4-94fb-9946214f4244
Date: Wed, 25 Nov 2015 05:43:06 GMT

{
    "totalCount": 1,
    "items": [{
        "id": "83ef9d05-4169-4ef9-9657-0e86b1eab1de",
        "entitlementId": "a356ac8c-e310-44f4-bf85-C7f29044af99",
        "friendlyName": "nickname",
        "quantity": 1,
        "unitType": "none",
        "creationDate": "2015-11-25T06: 41: 12Z",
        "effectiveStartDate": "2015-11-24T08: 00: 00Z",
        "commitmentEndDate": "2016-12-12T08: 00: 00Z",
        "status": "active",
        "autoRenewEnabled": false,
        "billingType": "none",
        "contractType": "subscription",
        "links": {
            "offer": {
                "uri": "/v1/offers/0CCA44D6-68E9-4762-94EE-31ECE98783B9",
                "method": "GET",
                "headers": []
            },
            "self": {
                "uri": "/subscriptions?key=<key>",
                "method": "GET",
                "headers": []
            }
        },
        "orderId": "6183db3d-6318-4e52-877e-25806e4971be",
        "attributes": {
            "etag": "<etag>",
            "objectType": "Subscription"
        }
    }],
    "attributes": {
        "objectType": "Collection"
    }
}

オンライン サービスとソフトウェアを使用した新しいコマース サブスクリプションの応答例

{
  "totalCount": 2,
  "items": [
    {
      "id": "e669812a-8920-452e-dd39-d5f20d61a1b1",
      "offerId": "CFQ7TTC0LFLZ:0002:CFQ7TTC0MKD5",
      "offerName": "Microsoft 365 E5",
      "friendlyName": "Microsoft 365 E5",
      "productType": {
        "id": "OnlineServicesNCE",
        "displayName": "OnlineServicesNCE"
      },
      "quantity": 1,
      "unitType": "Licenses",
      "hasPurchasableAddons": false,
      "consumptionType": "overage",
      "creationDate": "2023-11-28T22:28:50.7842638Z",
      "effectiveStartDate": "2023-11-28T00:00:00Z",
      "commitmentEndDate": "2023-12-27T00:00:00Z",
      "commitmentEndDateTime": "2023-12-27T23:59:59Z",
      "cancellationAllowedUntilDate": "2023-12-05T22:29:25.9967858Z",
      "billingCycleEndDate": "2023-12-27T00:00:00Z",
      "billingCycleEndDateTime": "2023-12-27T23:59:59Z",
      "status": "active",
      "autoRenewEnabled": true,
      "isTrial": false,
      "billingType": "license",
      "billingCycle": "monthly",
      "termDuration": "P1M",
      "renewalTermDuration": "",
      "refundOptions": [
        {
          "type": "Full",
          "expiresAt": "2023-11-29T22:29:25.9967858Z"
        }
      ],
      "isMicrosoftProduct": true,
      "partnerId": "",
      "attentionNeeded": false,
      "actionTaken": false,
      "contractType": "subscription",
      "links": {
        "product": {
          "uri": "/products/CFQ7TTC0LFLZ?country=US",
          "method": "GET",
          "headers": []
        },
        "sku": {
          "uri": "/products/CFQ7TTC0LFLZ/skus/0002?country=US",
          "method": "GET",
          "headers": []
        },
        "availability": {
          "uri": "/products/CFQ7TTC0LFLZ/skus/0002/availabilities/CFQ7TTC0MKD5?country=US",
          "method": "GET",
          "headers": []
        },
        "self": {
          "uri": "/customers/bfb6b398-c7f5-40f0-aa75-a1f1adf81374/subscriptions/e669812a-8920-452e-dd39-d5f20d61a1b1",
          "method": "GET",
          "headers": []
        }
      },
      "publisherName": "Microsoft Corporation",
      "orderId": "f9a896ba4686",
      "attributes": {
        "objectType": "Subscription"
      }
    },
    {
      "id": "71e8b7b6-ce70-4901-cc72-15042a3230a1",
      "offerId": "DG7GMGF0GJC2:0003:DG7GMGF0CFC5",
      "offerName": "Azure SQL Edge - 1 year",
      "friendlyName": "Azure SQL Edge",
      "productType": {
        "id": "Software",
        "displayName": "Software"
      },
      "quantity": 1,
      "unitType": "Licenses",
      "hasPurchasableAddons": false,
      "creationDate": "2023-11-28T22:21:15.015299Z",
      "effectiveStartDate": "2023-11-28T22:21:12.5336906Z",
      "commitmentEndDate": "2024-11-27T00:00:00Z",
      "commitmentEndDateTime": "2024-11-27T23:59:59Z",
      "cancellationAllowedUntilDate": "2023-12-05T22:21:37.7730547Z",
      "billingCycleEndDate": "2024-11-27T00:00:00Z",
      "billingCycleEndDateTime": "2024-11-27T23:59:59Z",
      "status": "active",
      "autoRenewEnabled": true,
      "isTrial": false,
      "billingType": "license",
      "billingCycle": "annual",
      "termDuration": "P1Y",
      "renewalTermDuration": "",
      "isMicrosoftProduct": true,
      "partnerId": "",
      "attentionNeeded": false,
      "actionTaken": false,
      "contractType": "subscription",
      "links": {
        "product": {
          "uri": "/products/DG7GMGF0GJC2?country=US",
          "method": "GET",
          "headers": []
        },
        "sku": {
          "uri": "/products/DG7GMGF0GJC2/skus/0003?country=US",
          "method": "GET",
          "headers": []
        },
        "availability": {
          "uri": "/products/DG7GMGF0GJC2/skus/0003/availabilities/DG7GMGF0CFC5?country=US",
          "method": "GET",
          "headers": []
        },
        "self": {
          "uri": "/customers/bfb6b398-c7f5-40f0-aa75-a1f1adf81374/subscriptions/71e8b7b6-ce70-4901-cc72-15042a3230a1",
          "method": "GET",
          "headers": []
        }
      },
      "publisherName": "Microsoft",
      "orderId": "be34ac49aefb",
      "attributes": {
        "objectType": "Subscription"
      }
    }
  ]
}