次の方法で共有


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

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

特定の Microsoft AI Cloud パートナー プログラム パートナーによって指定された顧客に提供されるサブスクリプションの一覧を取得する方法。

前提条件

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

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

  • A PartnerID

C#

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

// IAggregatePartner partnerOperations;
// string customerId;
// string partnerMpnId;

var customerSubscriptionsByMpnId = partnerOperations.Customers.ById(customerId).Subscriptions.ByPartner(partnerMpnId).Get();

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

Java

パートナー センター Java SDK を使用して、パートナー センター リソースを管理できます。 これは、パートナー コミュニティによって管理され、Microsoft によって正式にサポートされていないオープンソース プロジェクトです。 問題が発生した場合は、コミュニティから支援を得るか、GitHub に問題を投稿することができます。

特定のパートナーから指定された顧客に提供されたサブスクリプションの一覧を取得するには、まず、顧客 ID を指定して IAggregatePartner.getCustomers.byId 関数を使用して顧客を識別します。 次に、getSubscriptions 関数から顧客サブスクリプションコレクション操作へのインターフェイスを取得し、PartnerID で byPartner 関数を呼び出してパートナーを識別し、パートナー サブスクリプション操作のインターフェイスを取得します。 最後に、get 関数を呼び出してコレクションを取得します。

// IAggregatePartner partnerOperations;
// String customerId;
// String partnerMpnId;

ResourceCollection<Subscription> customerSubscriptionsByMpnId = partnerOperations.getCustomers().byId(customerId).getSubscriptions().byPartner(partnerMpnId).get();

PowerShell

パートナー センター PowerShell モジュールを使用して、パートナー センター リソースを管理できます。 これは、パートナー コミュニティによって管理され、Microsoft によって正式にサポートされていないオープンソース プロジェクトです。 問題が発生した場合は、コミュニティから支援を得るか、GitHub に問題を投稿することができます。

指定したパートナーから指定した顧客に提供されたサブスクリプションの一覧を取得するには、Get-PartnerCustomerSubscription コマンドを実行します。 CustomerId パラメーターを使用して顧客を識別する顧客 ID を指定し、MpnId パラメーターに PartnerID を設定してパートナーを識別します。

# $customerId
# $partnerMpnId

Get-PartnerCustomerSubscription -CustomerId $customerId -MpnId $partnerMpnId

REST 要求

要求の構文

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

URI パラメーター

次のパスとクエリ パラメーターを使用して、顧客とパートナーを特定します。

名前 種類 必須 説明
customer-id string はい 顧客を識別する GUID 形式の文字列。
mpn-id INT はい パートナーを識別する PartnerID。

要求ヘッダー

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

要求本文

[なし] :

要求の例

GET https://api.partnercenter.microsoft.com/v1/customers/c501c3c4-d776-40ef-9ecf-9cefb59442c1/subscriptions?mpn_id=4847383 HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd 
MS-RequestId: f98d0f61-01da-4d27-a923-8ec1e46e7358 
X-Locale: en-US
Host: api.partnercenter.microsoft.com
Connection: Keep-Alive

REST 応答

成功した場合、応答本文にはサブスクリプション リソースのコレクションが含まれます。

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

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

応答の例

HTTP/1.1 200 OK
Content-Length: 985
Content-Type: application/json; charset=utf-8
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: f98d0f61-01da-4d27-a923-8ec1e46e7358
Date: Thu, 13 Apr 2024 20:58:08 GMT

{ 
  "totalCount": 2, 
  "items": [ 
    { 
      "id": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e", 
      "offerId": "DB2E705F-B82A-4024-A3D5-D88E12F2DB35", 
      "offerName": "Intune Device", 
      "friendlyName": "new offer purchase", 
      "quantity": 5, 
      "unitType": "Licenses", 
      "creationDate": "2024-04-10T23:02:26.02Z", 
      "effectiveStartDate": "2024-04-10T00:00:00Z", 
      "commitmentEndDate": "2025-05-07T00:00:00Z", 
      "status": "active", 
      "autoRenewEnabled": true, 
      "isTrial": false, 
      "billingType": "license", 
      "billingCycle": "monthly", 
      "partnerId": "4847383", 
      "contractType": "subscription", 
      "links": { 
        "offer": { 
          "uri": "/offers/DB2E705F-B82A-4024-A3D5-D88E12F2DB35?country=US", 
          "method": "GET", 
          "headers": [] 
        }, 
        "self": { 
          "uri": "/customers/c501c3c4-d776-40ef-9ecf-9cefb59442c1/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e", 
          "method": "GET", 
          "headers": [] 
        } 
      }, 
      "orderId": "3EDDCAC6-63B2-4C40-B0B6-F47E18301492", 
      "attributes": { 
        "etag": "eyJpZCI6IjQyMjI2ZWQ2LTA3MGEtNGUwZi1iODBjLTRjZGZiM2U5N2FhNyIsInZlcnNpb24iOjF9", 
        "objectType": "Subscription" 
      } 
    }, 
    { 
        "id": "bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f", 
        "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/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f", 
                "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" } 
} 

関連項目