Condividi tramite


Ottenere un elenco di SKU per un prodotto (per paese/area geografica)

È possibile ottenere una raccolta di SKU disponibili in un paese/area geografica per un prodotto specifico usando le API del Centro per i partner.

Prerequisiti

  • Credenziali come descritte nell'autenticazione del Partner Center . Questo scenario supporta l'autenticazione con le credenziali per app autonome e App+Utente.

  • Identificatore del prodotto.

C#

Per ottenere l'elenco degli SKU per un prodotto:

  1. Ottenere un'interfaccia per le operazioni di un prodotto specifico seguendo i passaggi descritti in Ottenere un prodotto in base all'ID.

  2. Dall'interfaccia, selezionare la proprietà SKU per ottenere un'interfaccia con le operazioni disponibili per gli SKU.

  3. Chiamare il metodo Get() o GetAsync() per ottenere una raccolta degli SKU del prodotto disponibili.

  4. (Facoltativo) Selezionare l'ambito della prenotazione usando il metodo ByReservationScope().

  5. (Facoltativo) Usare il metodo ByTargetSegment() per filtrare gli SKU per segmento di destinazione prima di chiamare Get() o GetAsync().

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();

Giava

Per gestire le risorse del Centro per i partner, è possibile usare Java SDK del Centro per i partner. Si tratta di un progetto open source gestito dalla community partner e non ufficialmente supportato da Microsoft. È possibile ottenere assistenza dalla community o aprire un problema in GitHub se si verifica un problema.

Per ottenere l'elenco degli SKU per un prodotto:

  1. Ottenere un'interfaccia per le operazioni di un prodotto specifico seguendo i passaggi descritti in Ottenere un prodotto in base all'ID.

  2. Dall'interfaccia selezionare la funzione getSkus per ottenere un'interfaccia con le operazioni disponibili per gli SKU.

  3. Chiamare la funzione get() per recuperare una raccolta degli SKU disponibili per il prodotto.

  4. (Facoltativo) Usare la funzione byTargetSegment() per filtrare gli SKU in base al segmento di destinazione prima di chiamare la funzione get().

// 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

Il modulo PowerShell centro per i partner può essere usato per gestire le risorse del Centro per i partner. Si tratta di un progetto open source gestito dalla community partner e non ufficialmente supportato da Microsoft. È possibile ottenere assistenza dalla community o aprire un problema in GitHub se si verifica un problema.

Per ottenere l'elenco degli SKU per un prodotto:

  1. Eseguire il comando Get-PartnerProductSku .

  2. (Facoltativo) Specificare il parametro segmento per filtrare gli SKU in base al segmento di destinazione.

# $productId
# $targetSegment

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

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

Richiesta REST

Sintassi della richiesta

Metodo URI della richiesta
OTTIENI {baseURL}/v1/products/{product-id}/skus?country={country-code}&targetSegment={target-segment} HTTP/1.1

Parametri URI

Usare il percorso e i parametri di query seguenti per ottenere un elenco di SKU per un prodotto.

Nome Digitare Obbligatorio Descrizione
ID prodotto corda Stringa che identifica il prodotto.
codice paese corda ID paese/area geografica.
segmento di destinazione corda NO Stringa che identifica il segmento di destinazione utilizzato per il filtro.
ambito di prenotazione corda NO Quando si esegue una query per un elenco di SKU per un prodotto Prenotazione di Azure, specificare reservationScope=AzurePlan per ottenere un elenco di SKU applicabili ad AzurePlan. Escludere questo parametro per ottenere un elenco di SKU per i prodotti di prenotazione di Azure applicabili alle sottoscrizioni di Microsoft Azure (MS-AZR-0145P).

Intestazioni della richiesta

Per ulteriori informazioni, vedere Partner Center header REST.

Corpo della richiesta

Nessuno.

Esempi di richiesta

Ottenere un elenco di SKU per un determinato prodotto:

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: aaaa0000-bb11-2222-33cc-444444dddddd

Ottieni un elenco di SKU per un prodotto di prenotazione Azure. Includere solo gli SKU applicabili ai piani di Azure e non alle sottoscrizioni di Microsoft Azure (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: aaaa0000-bb11-2222-33cc-444444dddddd

Ottieni un elenco di SKU per un prodotto di prenotazione Azure. Includere solo gli SKU applicabili alle sottoscrizioni di Microsoft Azure (MS-AZR-0145P) e non ai piani di Azure:

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: aaaa0000-bb11-2222-33cc-444444dddddd

Risposta REST

In caso di esito positivo, il corpo della risposta contiene una raccolta di risorse SKU.

Codici di errore e esito positivo della risposta

Ogni risposta viene fornita con un codice di stato HTTP che indica l'esito positivo o negativo e altre informazioni di debug. Usare uno strumento di traccia di rete per leggere il codice, il tipo di errore e i parametri aggiuntivi. Per l'elenco completo, vedere codici di errore del Partner Center.

Questo metodo restituisce i codici di errore seguenti:

Codice di stato HTTP Codice di errore Descrizione
403 400030 L'accesso al targetSegment richiesto non è consentito.
404 400013 Impossibile trovare il prodotto padre.

Esempio di risposta per le prenotazioni di macchine virtuali di Azure (piano di Azure)

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/10.0
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd,aaaa0000-bb11-2222-33cc-444444dddddd
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"
    }
}

Esempio di risposta per i nuovi servizi basati su licenza commerciale

Nota

Le nuove esperienze commerciali per i servizi basati su licenza includono molte nuove funzionalità e sono disponibili per tutti i provider di soluzioni cloud. Per altre informazioni, vedere panoramica delle nuove esperienze commerciali.

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/10.0
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd,aaaa0000-bb11-2222-33cc-444444dddddd
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"
    }
}