Een SKU ophalen op basis van id
Hiermee haalt u een SKU op voor het opgegeven product met behulp van de opgegeven SKU-id.
Voorwaarden
Referenties zoals beschreven in Partner Center-authenticatie. 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 basis van id om de interface voor de bewerkingen van een specifiek product op te halen. Selecteer in de resulterende interface de eigenschap SKUs om een interface met de beschikbare bewerkingen voor SKUs te verkrijgen. Geef de SKU-id door aan de ById() methode en roep Get() of GetAsync() aan om de SKU-gegevens 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 | Tik | Vereist | Beschrijving |
---|---|---|---|
product-ID | snaar | Ja | Een tekenreeks die het product identificeert. |
sku-id | reeks | Ja | Een tekenreeks die de SKU identificeert. |
landcode | string | Ja | Een land-/regio-id. |
Aanvraagheaders
Zie Partnercentrum REST-headersvoor meer informatie.
Inhoud van het verzoek
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: aaaa0000-bb11-2222-33cc-444444dddddd
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 met nuttige informatie.
Partners worden aangemoedigd om de Partner center REST API'ste 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 of het succesvol of mislukt is, evenals aanvullende informatie voor foutopsporing. Gebruik een hulpprogramma voor netwerktracering om deze code, het fouttype en aanvullende parameters te lezen. Zie Partnercentrum-foutcodesvoor de volledige lijst.
Deze methode retourneert de volgende foutcodes:
HTTP-statuscode | Foutcode | Beschrijving |
---|---|---|
404 | 400013 | Het product is niet gevonden. |
404 | 400018 | SKU 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: aaaa0000-bb11-2222-33cc-444444dddddd,aaaa0000-bb11-2222-33cc-444444dddddd
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": []
}
}
}
Voorbeeldantwoord voor nieuwe op licenties gebaseerde commerciediensten
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 overzicht van nieuwe commerce-ervaringenvoor meer informatie.
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/10.0
MS-CorrelationId: bbbb1111-cc22-3333-44dd-555555eeeeee,bbbb1111-cc22-3333-44dd-555555eeeeee
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": []
}
}
}