次の方法で共有


注文ごとにサブスクリプションの一覧を取得する

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

指定した順序に対応するサブスクリプション リソースのコレクションを取得します。

前提条件

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

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

  • 注文 ID。

C#

注文ごとのサブスクリプションの一覧を取得するには、IAggregatePartner.Customers コレクションを使用し、ById() メソッドを呼び出します。 次に、Subscriptions プロパティを呼び出し、その後に ByOrder() メソッドを呼び出します。 Get() または GetAsync() を呼び出して完了します。

// IAggregatePartner partnerOperations;
// var selectedCustomerId as string;
// string orderID;

ResourceCollection<Subscription> customerSubscriptions = partnerOperations.Customers.ById(selectedCustomerId).Subscriptions.ByOrder(orderID).Get();

サンプル: コンソール テスト アプリプロジェクト: PartnerSDK.FeatureSample クラス: SubscriptionsByOrder.cs

REST 要求

要求の構文

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

URI パラメーター

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

名前 タイプ 必須 説明
customer-tenant-id guid 顧客に対応する GUID。
id-for-order guid 順序に対応する GUID。

要求ヘッダー

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

要求本文

なし。

要求の例

GET https://api.partnercenter.microsoft.com/v1/customers/{customer-tenant-id}/subscriptions?order_id={id-for-order} HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 16fee928-dc2c-412f-adbb-871f68babf16
MS-CorrelationId: c49004b1-224f-4d86-a607-6c8bcc52cfdd
Connection: Keep-Alive

REST 応答

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

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

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

応答の例

HTTP/1.1 200 OK
Content-Length: 73754
Content-Type: application/json
MS-CorrelationId: c49004b1-224f-4d86-a607-6c8bcc52cfdd
MS-RequestId: 16fee928-dc2c-412f-adbb-871f68babf16
Date: Wed, 25 Nov 2015 05:50:45 GMT

{
    "totalCount": 1,
    "items": [{
        "id": "83ef9d05-4169-4ef9-9657-0e86b1eab1de",
        "entitlementId": "a356ac8c-e310-44f4-bf85-C7f29044af99",
        "friendlyName": "Myofferpurchase",
        "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": "{id-for-order}",
        "attributes": {
            "etag": "<etag>",
            "objectType": "Subscription"
        }
    }],
    "attributes": {
        "objectType": "Collection"
    }
}

新しいコマースでの応答の例

GET https://api.partnercenter.microsoft.com/v1/customers/c501c3c4-d776-40ef-9ecf-9cefb59442c1//subscriptions?order_id=79d9f5e2f43a HTTP/1.1
Content-Length: 73754
Content-Type: application/json
MS-RequestId: 261a7eab-99ba-4fef-b3f1-476ebfddfa52
MS-CorrelationId: 9972257f-c746-44fd-bd60-8a33e5982e55
Date: Thurs, 6 June 2024 10:50:45 GMT

{
  "totalCount": 1,
  "items": [
    {
        "id": "0ee4f7f6-b583-403e-81bb-9facbc96ef54",
        "offerId": "CFQ7TTC0LH18:0001:CFQ7TTC0P0WS",
        "offerName": "Microsoft 365 Business Basic",
        "friendlyName": "Microsoft 365 Business Basic",
        "productType": {
            "id": "OnlineServicesNCE",
            "displayName": "OnlineServicesNCE"
        },
        "quantity": 2,
        "unitType": "Licenses",
        "hasPurchasableAddons": false,
        "creationDate": "2024-06-05T19:26:38.3667635Z",
        "effectiveStartDate": "2024-06-05T00:00:00Z",
        "commitmentEndDate": "2024-07-04T00:00:00Z",
        "commitmentEndDateTime": "2024-07-04T23:59:59Z",
        "cancellationAllowedUntilDate": "2024-06-12T19:27:03.440527Z",
        "billingCycleEndDate": "2024-07-04T00:00:00Z",
        "billingCycleEndDateTime": "2024-07-04T23:59:59Z",
        "status": "active",
        "autoRenewEnabled": true,
        "isTrial": false,
        "billingType": "license",
        "billingCycle": "monthly",
        "termDuration": "P1M",
        "renewalTermDuration": "",
        "isMicrosoftProduct": true,
        "partnerId": "4847383",
        "attentionNeeded": false,
        "actionTaken": false,
        "contractType": "subscription",
        "links": {
            "product": {
                "uri": "/products/CFQ7TTC0LH18?country=US",
                "method": "GET",
                "headers": []
            },
            "sku": {
                "uri": "/products/CFQ7TTC0LH18/skus/0001?country=US",
                "method": "GET",
                "headers": []
            },
            "availability": {
                "uri": "/products/CFQ7TTC0LH18/skus/0001/availabilities/CFQ7TTC0P0WS?country=US",
                "method": "GET",
                "headers": []
            },
            "self": {
                "uri": "/customers/c501c3c4-d776-40ef-9ecf-9cefb59442c1/subscriptions/0ee4f7f6-b583-403e-81bb-9facbc96ef54",
                "method": "GET",
                "headers": []
            }
        },
        "publisherName": "Microsoft Corporation",
        "refundableQuantity": {
            "totalQuantity": 1,
            "details": [
                {
                    "quantity": 1,
                    "allowedUntilDateTime": "2024-06-14T17:41:13.4675407Z"
                }
            ]
        },
        "orderId": "79d9f5e2f43a",
        "attributes": {
            "objectType": "Subscription"
        }
    }
  ],
  "attributes": { "objectType": "Collection" }
}