SKU の可用性の一覧を取得する (国/リージョン別)

この記事では、指定した製品と SKU の特定の国/リージョンで可用性のコレクションを取得する方法について説明します。

前提条件

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

  • 製品識別子。

  • SKU 識別子。

  • 国/地域。

C#

SKU の可用性一覧を取得するには:

  1. 「ID による SKU の取得」の手順に従って、特定の SKU の操作のインターフェイスを取得します。

  2. SKU インターフェイスから Availabilities プロパティを 選択して、可用性 の操作を含むインターフェイスを取得します。

  3. (省略可能) ByTargetSegment() メソッドを使用して、ターゲット セグメントで可用性をフィルター処理します。 含まれていない場合は、非営利団体を除くすべてのセグメントが返されます。 非営利の可用性を得るには、特に非営利団体に合格する必要があります。

  4. Get() または GetAsync() を呼び出して、この SKU の可用性のコレクションを取得します。

IAggregatePartner partnerOperations;
string countryCode;
string productId;
string skuId;
string targetSegment;
string productIdForAzureReservation;
string skuIdForAzureReservation;

// Get the availabilities.
var availabilities = partnerOperations.Products.ByCountry(countryCode).ById(productId).Skus.ById(skuId).Availabilities.Get();

// Get the availabilities, filtered by target segment.
var availabilities = partnerOperations.Products.ByCountry(countryCode).ById(productId).Skus.ById(skuId).Availabilities.BySegment(targetSegment).Get();

// Get the availabilities for an Azure reservation product and sku which are applicable to Microsoft Azure (MS-AZR-0145P) subscriptions only.
var availabilities = partnerOperations.Products.ByCountry(countryCode).ById(productIdForAzureReservation).Skus.ById(skuIdForAzureReservation).Availabilities.ByReservationScope("AzurePlan").Get();

// Get the availabilities for an Azure reservation product and sku which are applicable to Azure plans only.
var availabilities = partnerOperations.Products.ByCountry(countryCode).ById(productIdForAzureReservation).Skus.ById(skuIdForAzureReservation).Availabilities.Get();

REST 要求

要求の構文

認証方法 要求 URI
GET {baseURL}/v1/products/{product-id}/skus/{sku-id}/availabilities?country={country-code}>targetSegment={target-segment} HTTP/1.1

URI パラメーター

SKU の可用性の一覧を取得するには、次のパスとクエリ パラメーターを使用します。

名前 タイプ Required 説明
product-id string はい 製品を識別する文字列。
sku-id string はい SKU を識別する文字列。
country-code string はい 国/地域 ID。
target-segment string いいえ フィルター処理に使用されるターゲット セグメントを識別する文字列。 含まれていない場合は、非営利団体を除くすべてのセグメントが返されます。 非営利の可用性を得るには、特に非営利団体に合格する必要があります。
reservationScope string いいえ Azure Reservation SKU の可用性の一覧を照会する場合は、AzurePlan に適用される可用性の一覧を取得するように指定 reservationScope=AzurePlan します。 Microsoft Azure (MS-AZR-0145P) サブスクリプションに適用できる可用性の一覧を取得するには、このパラメーターを除外します。

要求ヘッダー

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

要求本文

なし。

要求の例

国ごとの SKU の可用性

国ごとの特定の SKU の可用性の一覧を取得するには、次の例に従います。

GET http:// api.partnercenter.microsoft.com/v1/products/DZH318Z0BQ3Q/skus/0001/availabilities?country=US HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 70324727-62d8-4195-8f99-70ea25058d02
MS-CorrelationId: 83b644b5-e54a-4bdc-b354-f96c525b3c58

VM 予約の可用性 (Azure プラン)

次の例に従って、Azure VM 予約 SKU の国ごとの可用性の一覧を取得します。 この例は、Azure プランに適用される SKU を対象にしています。

GET https://api.partnercenter.microsoft.com/v1/products/DZH318Z0BQ3Q/skus/0001/availabilities?country=US&targetView=AzureReservationsVM&reservationScope=AzurePlan HTTP/1.1
Authorization: Bearer
Accept: application/json
MS-RequestId: 031160b2-b0b0-4d40-b2b1-aaa9bb84211d
MS-CorrelationId: 7c1f6619-c176-4040-a88f-2c71f3ba4533

Microsoft Azure (MS-AZR-0145P) サブスクリプションの VM 予約の可用性

次の例に従って、Microsoft Azure (MS-AZR-0145P) サブスクリプションに適用される Azure VM 予約の国別の可用性の一覧を取得します。

GET https://api.partnercenter.microsoft.com/v1/products/DZH318Z0BQ3Q/skus/0001/availabilities?country=US&targetView=AzureAzureReservationsVM HTTP/1.1
Authorization: Bearer
Accept: application/json
MS-RequestId: 031160b2-b0b0-4d40-b2b1-aaa9bb84211d
MS-CorrelationId: 7c1f6619-c176-4040-a88f-2c71f3ba4533

REST 応答

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

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

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

このメソッドは、次のエラー コードを返します。

HTTP 状態コード エラー コード 説明
403 400030 要求された targetSegment へのアクセスは許可されません。

Azure VM 予約の応答の例 (Azure プラン)

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/10.0
MS-CorrelationId: 83b644b5-e54a-4bdc-b354-f96c525b3c58,83b644b5-e54a-4bdc-b354-f96c525b3c58
MS-RequestId: 70324727-62d8-4195-8f99-70ea25058d02,70324727-62d8-4195-8f99-70ea25058d02
X-Locale: en-US,en-US
X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcbWFtZW5kZVxkZXZcZHBzLXJwZVxSUEUuUGFydG5lci5TZXJ2aWNlLkNhdGFsb2dcV2ViQXBpc1xDYXRhbG9nU2VydmljZS5WMi5XZWJcdjFccHJvZHVjdHNcRFpIMzE4WjBCUTNRXHNrdXNcMDAwMVxhdmFpbGFiaWxpdGllcw==?=
X-Powered-By: ASP.NET
Date: Wed, 14 Mar 2018 22:19:37 GMT
Content-Length: 808

{
    "totalCount": 1,
    "items": [
        {
            "id": "DZH318XZXVNF",
            "productId": "DZH318Z0BQ3Q",
            "skuId": "0001",
            "catalogItemId": "DZH318Z0BQ3Q:0001:DZH318XZXVNF",
            "defaultCurrency": {
                "code": "USD",
                "symbol": "$"
            },
            "segment": "commercial",
            "country": "US",
            "isPurchasable": true,
            "isRenewable": false,
            "terms": [{
                "duration": "P1Y",
                "description": "1 Year Prepaid"
            }],
            "product": { ... },
            "sku": { ... },
            "links": {
                "self": {
                    "uri": "/products/DZH318Z0BQ3Q/skus/0001/availabilities/DZH318Z0HMKQ?country=US",
                    "method": "GET",
                    "headers": []
                }
            }
        }
    ],
    "links": {
        "self": {
            "uri": "/products/DZH318Z0BQ3Q/skus/0001/availabilities?country=US&targetSegment=commercial",
            "method": "GET",
            "headers": []
        }
    },
    "attributes": {
        "objectType": "Collection"
    }
}

新しいコマース ライセンス ベースのサービスの応答例

Note

ライセンスベースのサービスの新しいコマース エクスペリエンスには、多くの新機能が含まれており、すべてのクラウド ソリューション プロバイダー (CSP) で利用できます。 詳細については、新しいコマース エクスペリエンスの概要を参照してください。

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/10.0
MS-CorrelationId: 83b644b5-e54a-4bdc-b354-f96c525b3c58,83b644b5-e54a-4bdc-b354-f96c525b3c58
MS-RequestId: 70324727-62d8-4195-8f99-70ea25058d02,70324727-62d8-4195-8f99-70ea25058d02
X-Locale: en-US,en-US
X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcbWFtZW5kZVxkZXZcZHBzLXJwZVxSUEUuUGFydG5lci5TZXJ2aWNlLkNhdGFsb2dcV2ViQXBpc1xDYXRhbG9nU2VydmljZS5WMi5XZWJcdjFccHJvZHVjdHNcRFpIMzE4WjBCUTNRXHNrdXNcMDAwMVxhdmFpbGFiaWxpdGllcw==?=
X-Powered-By: ASP.NET
Date: Wed, 14 Mar 2018 22:19:37 GMT
Content-Length: 808

{
    "id": "CFQ7TTC0K971",
    "productId": "CFQ7TTC0LH18",
    "skuId": "0001",
    "catalogItemId": "CFQ7TTC0LH18:0001:CFQ7TTC0K971",
    "defaultCurrency": {
        "code": "USD",
        "symbol": "$"
    },
    "segment": "commercial",
    "country": "US",
    "isPurchasable": true,
    "isRenewable": true, 
    "renewalInstructions": [
        {
            "applicableTermIds": [
                "5aeco6mffyxo"
            ],
            "renewalOptions": [
                {
                    "renewToId": "CFQ7TTC0LH18:0001",
                    "isAutoRenewable": true
                }
            ]
        },
	 …
    ],
    "terms": [
        {
            "id": "5aeco6mffyxo",
            "duration": "P1Y",
            "description": "One-Year commitment for monthly/yearly billing",
            "billingCycle": "Annual",
            "cancellationPolicies": [
                {
                    "refundOptions": [
                        {
                            "sequenceId": 0,
                            "type": "Full",
                            "expiresAfter": "P1D"
                        }
                    ]
                }
            ]
        },
       …
    ],
    "links": {
        "self": {
            "uri": "/products/CFQ7TTC0LH18/skus/0001/availabilities/CFQ7TTC0K971?country=US",
            "method": "GET",
            "headers": []
        }
    },
        "links": {
            "availabilities": {
                "uri": "/products/CFQ7TTC0LH18/skus/0001/availabilities?country=US",
                "method": "GET",
                "headers": []
            },
            "self": {
                "uri": "/products/CFQ7TTC0LH18/skus/0001?country=US",
                "method": "GET",
                "headers": []
            }
        }
    }
}