Delen via


Een lijst met SKU's ophalen voor een product (per land/regio)

U kunt een verzameling SKU's ophalen die beschikbaar zijn in een land/regio voor een specifiek product met behulp van Partnercentrum-API's.

Vereisten

  • Referenties zoals beschreven in verificatie in partnercentrum. Dit scenario ondersteunt verificatie met zowel zelfstandige app- als app+gebruikersreferenties.

  • Een product-id.

C#

De lijst met SKU's voor een product ophalen:

  1. Haal een interface op voor de bewerkingen van een specifiek product door de stappen in Een product ophalen op id uit te voeren.

  2. Selecteer in de interface de eigenschap SKU's om een interface te verkrijgen met de beschikbare bewerkingen voor SKU's.

  3. Roep de methode Get() of GetAsync() aan om een verzameling van de beschikbare SKU's voor het product op te halen.

  4. (Optioneel) Selecteer het reserveringsbereik met behulp van de methode ByReservationScope().

  5. (Optioneel) Gebruik de methode ByTargetSegment() om de SKU's te filteren op doelsegment voordat u Get() of GetAsync() aanroept.

IAggregatePartner partnerOperations;

string countryCode;
string productId;
string productIdForAzureReservation;
string targetSegment;

// Get the available SKUs.
var skus = partnerOperations.Products.ByCountry(countryCode).ById(productId).Skus.Get();

// Get the available SKUs, filtered by target segment.
var segmentSkus = partnerOperations.Products.ByCountry(countryCode).ById(productId).Skus.ByTargetSegment(targetSegment).Get();

// Get the skus for an Azure reservation product which are applicable to Microsoft Azure (MS-AZR-0145P) subscriptions only.
var skus = partnerOperations.Products.ByCountry(countryCode).ById(productIdForAzureReservation).Skus.Get();

// Get the skus for an Azure reservation product which are applicable to Azure plans only.
var skus = partnerOperations.Products.ByCountry(countryCode).ById(productIdForAzureReservation).Skus.ByReservationScope("AzurePlan").Get();

Java

De Partner Center Java SDK kan worden gebruikt voor het beheren van Partnercentrum-resources. Het is een opensource-project dat wordt onderhouden door de partnercommunity en niet officieel wordt ondersteund door Microsoft. U kunt hulp krijgen van de community of een probleem openen op GitHub als u een probleem ondervindt.

De lijst met SKU's voor een product ophalen:

  1. Haal een interface op voor de bewerkingen van een specifiek product door de stappen in Een product ophalen op id uit te voeren.

  2. Selecteer in de interface de functie getSkus om een interface te verkrijgen met de beschikbare bewerkingen voor SKU's.

  3. Roep de functie get() aan om een verzameling van de beschikbare SKU's voor het product op te halen.

  4. (Optioneel) Gebruik de functie byTargetSegment() om de SKU's te filteren op doelsegment voordat u de get() -functie aanroept.

// IAggregatePartner partnerOperations;

// String countryCode;
// String productId;
// String targetSegment;

// Get the available SKUs.
ResourceCollection<Sku> skus = partnerOperations.getProducts().byCountry(countryCode).byId(productId).getSkus().get();

// Get the available SKUs, filtered by target segment.
var segmentSkus = partnerOperations.getProducts().byCountry(countryCode).byId(productId).getSkus().byTargetSegment(targetSegment).get();

PowerShell

De PowerShell-module partnercentrum kan worden gebruikt voor het beheren van Partnercentrum-resources. Het is een opensource-project dat wordt onderhouden door de partnercommunity en niet officieel wordt ondersteund door Microsoft. U kunt hulp krijgen van de community of een probleem openen op GitHub als u een probleem ondervindt.

De lijst met SKU's voor een product ophalen:

  1. Voer de opdracht Get-PartnerProductSku uit.

  2. (Optioneel) Geef de parameter Segment op om de SKU's te filteren op doelsegment.

# $productId
# $targetSegment

# Get the available SKUs.
Get-PartnerProductSku -ProductId $productId

# Get the available SKUs, filtered by target segment.
Get-PartnerProductSku -ProductId $productId -Segment $targetSegment

REST-aanvraag

Aanvraagsyntaxis

Wijze Aanvraag-URI
GET {baseURL}/v1/products/{product-id}/skus?country={country-code}&targetSegment={target-segment} HTTP/1.1

URI-parameters

Gebruik het volgende pad en queryparameters om een lijst met SKU's voor een product op te halen.

Name Type Vereist Beschrijving
product-id tekenreeks Ja Een tekenreeks die het product identificeert.
landcode tekenreeks Ja Een land-/regio-id.
doelsegment tekenreeks Nee Een tekenreeks die het doelsegment identificeert dat wordt gebruikt voor filteren.
reservationScope tekenreeks Nee Wanneer u een query uitvoert op een lijst met SKU's voor een Azure-reserveringsproduct, geeft u reservationScope=AzurePlan een lijst op met SKU's die van toepassing zijn op AzurePlan. Sluit deze parameter uit om een lijst met SKU's op te halen voor Azure-reserveringsproducten die van toepassing zijn op Microsoft Azure-abonnementen (MS-AZR-0145P).

Aanvraagheaders

Zie Rest-headers in Partnercentrum voor meer informatie.

Aanvraagtekst

Geen.

Voorbeelden van aanvragen

Een lijst met SKU's ophalen voor een bepaald product:

GET http://api.partnercenter.microsoft.com/v1/products/DZH318Z0BPS6/skus?country=US HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 18b41adf-29b5-48eb-b14f-c9683a4e5b7d
MS-CorrelationId: e75c1060-852e-4b49-92b0-cd15167a0d51

Haal een lijst met SKU's op voor een Azure Reservation-product. Neem alleen de SKU's op die van toepassing zijn op Azure-abonnementen en niet op Microsoft Azure -abonnementen (MS-AZR-0145P):

GET http://api.partnercenter.microsoft.com/v1/products/DZH318Z0BQ5S/skus?country=US&reservationScope=AzurePlan HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 18b41adf-29b5-48eb-b14f-c9683a4e5b7d
MS-CorrelationId: e75c1060-852e-4b49-92b0-cd15167a0d51

Haal een lijst met SKU's op voor een Azure Reservation-product. Neem alleen de SKU's op die van toepassing zijn op Microsoft Azure-abonnementen (MS-AZR-0145P) en niet op Azure-abonnementen:

GET http://api.partnercenter.microsoft.com/v1/products/DZH318Z0BQ5S/skus?country=US HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 18b41adf-29b5-48eb-b14f-c9683a4e5b7d
MS-CorrelationId: e75c1060-852e-4b49-92b0-cd15167a0d51

REST-antwoord

Als dit lukt, bevat de hoofdtekst van het antwoord een verzameling SKU-resources .

Geslaagde antwoorden en foutcodes

Elk antwoord wordt geleverd met een HTTP-statuscode die aangeeft dat de fout is geslaagd of mislukt en aanvullende informatie over foutopsporing. Gebruik een hulpprogramma voor netwerktracering om deze code, het fouttype en aanvullende parameters te lezen. Zie foutcodes in Partnercentrum voor de volledige lijst.

Deze methode retourneert de volgende foutcodes:

HTTP-statuscode Foutcode Beschrijving
403 400030 Toegang tot het aangevraagde targetSegment is niet toegestaan.
404 400013 Het bovenliggende product is niet gevonden.

Antwoordvoorbeeld voor Azure VM-reserveringen (Azure-abonnement)

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/10.0
MS-CorrelationId: e75c1060-852e-4b49-92b0-cd15167a0d51,e75c1060-852e-4b49-92b0-cd15167a0d51
MS-RequestId: 18b41adf-29b5-48eb-b14f-c9683a4e5b7d,18b41adf-29b5-48eb-b14f-c9683a4e5b7d
X-Locale: en-US,en-US
X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcbWFtZW5kZVxkZXZcZHBzLXJwZVxSUEUuUGFydG5lci5TZXJ2aWNlLkNhdGFsb2dcV2ViQXBpc1xDYXRhbG9nU2VydmljZS5WMi5XZWJcdjFccHJvZHVjdHNcRFpIMzE4WjBCUTVTXHNrdXM=?=
X-Powered-By: ASP.NET
Date: Thu, 15 Mar 2018 21:06:03 GMT
Content-Length: 50917

{
    "totalCount": 40,
    "items": [
        {
            "id": "0001",
            "productId": "DZH318Z0BQ5S",
            "title": "Reserved VM Instance, Standard_ND12s, US West 2, 1 Year",
            "description": "Reserved Virtual Machines Instance, Standard_ND12s, US West 2, 1 Year",
            "minimumQuantity": 1,
            "maximumQuantity": 999999999,
            "isTrial": false,
            "supportedBillingCycles": [
                "one_time"
            ],
            "purchasePrerequisites": [
                "AzureSubscriptionRegistration",
                "InventoryCheck"
            ],
            "provisioningVariables": [
                "Scope",
                "SubscriptionId"
            ],
            "dynamicAttributes": {
                "armSkuName": "Standard_ND12s",
                "cores": "12",
                "ram": "224",
                "skuDisplayName": "ND12",
                "category": "GPU",
                "armRegionName": "westus2",
                "duration": "1Year",
                "region": "US West 2",
                "diskType": "Hdd"
            },
            "links": {
                "availabilities": {
                    "uri": "/products/DZH318Z0BQ5S/skus/0001/availabilities?country=US",
                    "method": "GET",
                    "headers": []
                },
                "self": {
                    "uri": "/products/DZH318Z0BQ5S/skus/0001?country=US",
                    "method": "GET",
                    "headers": []
                }
            }
        },
        {
            "id": "0002",
            "productId": "DZH318Z0BQ5S",
            "title": "Reserved VM Instance, Standard_ND6s, US West 2, 1 Year",
            "description": "Reserved Virtual Machines Instance, Standard_ND6s, US West 2, 1 Year",
            "minimumQuantity": 1,
            "maximumQuantity": 999999999,
            "isTrial": false,
            "supportedBillingCycles": [
                "one_time"
            ],
            "purchasePrerequisites": [
                "AzureSubscriptionRegistration",
                "InventoryCheck"
            ],
            "provisioningVariables": [
                "Scope",
                "SubscriptionId"
            ],
            "dynamicAttributes": {
                "armSkuName": "Standard_ND6s",
                "cores": "6",
                "ram": "112",
                "skuDisplayName": "ND6",
                "category": "GPU",
                "armRegionName": "westus2",
                "duration": "1Year",
                "region": "US West 2",
                "diskType": "Hdd"
            },
            "links": {
                "availabilities": {
                    "uri": "/products/DZH318Z0BQ5S/skus/0002/availabilities?country=US",
                    "method": "GET",
                    "headers": []
                },
            "self": {
                    "uri": "/products/DZH318Z0BQ5S/skus/0002?country=US",
                    "method": "GET",
                    "headers": []
                }
            }
        }
        [...]
    ],
    "links": {
        "self": {
            "uri": "/products/DZH318Z0BQ5S/skus?country=US",
            "method": "GET",
            "headers": []
        }
    },
    "attributes": {
        "objectType": "Collection"
    }
}

Antwoordvoorbeeld voor nieuwe commercelicentieservices

Notitie

De nieuwe commerce-ervaringen voor services op basis van licenties omvatten veel nieuwe mogelijkheden en zijn beschikbaar voor alle CSP's (Cloud Solution Provider). Zie het overzicht van nieuwe commerce-ervaringen voor meer informatie.

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/10.0
MS-CorrelationId: e75c1060-852e-4b49-92b0-cd15167a0d51,e75c1060-852e-4b49-92b0-cd15167a0d51
MS-RequestId: 18b41adf-29b5-48eb-b14f-c9683a4e5b7d,18b41adf-29b5-48eb-b14f-c9683a4e5b7d
X-Locale: en-US,en-US
X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcbWFtZW5kZVxkZXZcZHBzLXJwZVxSUEUuUGFydG5lci5TZXJ2aWNlLkNhdGFsb2dcV2ViQXBpc1xDYXRhbG9nU2VydmljZS5WMi5XZWJcdjFccHJvZHVjdHNcRFpIMzE4WjBCUTVTXHNrdXM=?=
X-Powered-By: ASP.NET
Date: Thu, 15 Mar 2018 21:06:03 GMT
Content-Length: 50917

{
    "totalCount": 40,
    "items": [
        {
{
    "id": "0001",
    "productId": "CFQ7TTC0LH18",
    "title": "Microsoft 365 Business Basic",
    "description": "Best for businesses that need professional email, cloud file storage, and online meetings & chat. Desktop versions of Office apps like Excel, Word, and PowerPoint not included. For businesses with up to 300 employees.",
    "minimumQuantity": 1,
    "maximumQuantity": 300,
    "isTrial": false,
    "supportedBillingCycles": [
        "annual",
        "monthly"
    ],
    "purchasePrerequisites": [
        "MicrosoftCloudAgreement"
    ],
    "inventoryVariables": [],
    "provisioningVariables": [],
    "actions": [
        "Refund"
    ],
    "dynamicAttributes": {
        "isMicrosoftProduct": true,
        "hasConstraints": true,
        "isAddon": false,
        "prerequisiteSkus": [],
        "isSoftwareAssuranceApplicable": false,
        "upgradeTargetOffers": [
            "CFQ7TTC0LDPB:0001",
            "CFQ7TTC0LF8Q:0001"
…
        ],
        "provisioningId": "3b555118-da6a-4418-894f-7df1e2096870",
        "internal": false
    },
    "links": {
        "availabilities": {
            "uri": "/products/CFQ7TTC0LH18/skus/0001/availabilities?country=US",
            "method": "GET",
            "headers": []
        },
        "self": {
            "uri": "/products/CFQ7TTC0LH18/skus/0001?country=US",
            "method": "GET",
            "headers": []
        }
    }
}        [...]
    ],
    "links": {
        "self": {
            "uri": "/products/DZH318Z0BQ5S/skus?country=US",
            "method": "GET",
            "headers": []
        }
    },
    "attributes": {
        "objectType": "Collection"
    }
}