Een SKU ophalen op basis van id

Hiermee haalt u een SKU op voor het opgegeven product met behulp van de opgegeven SKU-id.

Vereisten

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

  • Een product-id.

  • Een SKU-id.

C#

Als u de details van een specifieke SKU wilt ophalen, volgt u eerst de stappen in Een product ophalen op id om de interface voor de bewerkingen van een specifiek product op te halen. Selecteer in de resulterende interface de eigenschap SKU's om een interface te verkrijgen met de beschikbare bewerkingen voor SKU's. Geef de SKU-id door aan de methode ById() en roep Get() of GetAsync() aan om de SKU-details op te halen.

IAggregatePartner partnerOperations;
string countryCode;
string productId;
string skuId;

// Get the SKU details.
var sku = partnerOperations.Products.ByCountry(countryCode).ById(productId).Skus.ById(skuId).Get();

REST-aanvraag

Aanvraagsyntaxis

Methode Aanvraag-URI
GET {baseURL}/v1/products/{product-id}/skus/{sku-id}?country={country-code} HTTP/1.1

URI-parameter

Gebruik het volgende pad en queryparameters om een SKU op te halen voor het opgegeven product met behulp van de opgegeven SKU-id.

Naam Type Vereist Beschrijving
product-id tekenreeks Ja Een tekenreeks die het product identificeert.
sku-id tekenreeks Ja Een tekenreeks die de SKU identificeert.
landcode tekenreeks Ja Een land-/regio-id.

Aanvraagheaders

Zie Rest-headers in Partnercentrum voor meer informatie.

Aanvraagtekst

Geen.

Aanvraagvoorbeeld

GET http://api.partnercenter.microsoft.com/v1/products/DZH318Z0BQ3V/skus/00G1?country=US HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: e0ae69a5-6322-4d7e-809d-59e02b51d71f
MS-CorrelationId: 956eae17-7650-4470-94d2-4f61b9b02a23
X-Locale: en-US
MS-PartnerCenter-Client: Partner Center .NET SDK
MS-PartnerCenter-Application: Partner Center .NET SDK Samples
Host: api.partnercenter.microsoft.com

Belangrijk

Vanaf juni 2023 wordt de nieuwste Versie van Partner Center .NET SDK 3.4.0 gearchiveerd. U kunt de SDK-release downloaden van GitHub, samen met een leesmij-bestand dat nuttige informatie bevat.

Partners worden aangemoedigd om de REST API's van partnercentrum te blijven gebruiken.

REST-antwoord

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

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 Omschrijving
404 400013 Het product is niet gevonden.
404 400018 Er is geen SKU 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: 956eae17-7650-4470-94d2-4f61b9b02a23,956eae17-7650-4470-94d2-4f61b9b02a23
MS-RequestId: e0ae69a5-6322-4d7e-809d-59e02b51d71f,e0ae69a5-6322-4d7e-809d-59e02b51d71f
X-Locale: en-US,en-US
X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcbWFtZW5kZVxkZXZcZHBzLXJwZVxSUEUuUGFydG5lci5TZXJ2aWNlLkNhdGFsb2dcV2ViQXBpc1xDYXRhbG9nU2VydmljZS5WMi5XZWJcdjFccHJvZHVjdHNcRFpIMzE4WjBCUTNWXHNrdXNcMDBHMQ==?=
X-Powered-By: ASP.NET
Date: Thu, 15 Mar 2018 17:43:25 GMT
Content-Length: 1108

{
    "id": "00G1",
    "productId": "DZH318Z0BQ3V",
    "title": "Reserved VM Instance, Standard_D32s_v3, US West 2, 3 Years",
    "description": "Reserved Virtual Machines Instance, Standard_D32s_v3, US West 2, 3 Years",
    "minimumQuantity": 1,
    "maximumQuantity": 999999999,
    "isTrial": false,
    "supportedBillingCycles": [
        "one_time"
    ],
    "purchasePrerequisites": [
        "AzureSubscriptionRegistration",
        "InventoryCheck"
    ],
    "inventoryVariables": [
        "CustomerId",
        "AzureSubscriptionId"
    ],
    "provisioningVariables": [
        "Scope",
        "SubscriptionId"
    ],
    "dynamicAttributes": {
        "armSkuName": "Standard_D32s_v3",
        "cores": "32",
        "ram": "128",
        "skuDisplayName": "D32s v3",
        "category": "General purpose",
        "armRegionName": "westus2",
        "duration": "3Years",
        "region": "US West 2",
        "diskType": "Ssd"
    },
    "links": {
        "availabilities": {
            "uri": "/products/DZH318Z0BQ3V/skus/00G1/availabilities?country=us",
            "method": "GET",
            "headers": []
        },
        "self": {
            "uri": "/products/DZH318Z0BQ3V/skus/00G1?country=us",
            "method": "GET",
            "headers": []
        }
    }
}

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

{
    "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": []
        }
    }
}