Get the availability by ID
Gets the availability for the specified product and SKU using an availability ID. Availability IDs are mutable and dynamic, they're reissued on a regular basis. Partners should always be sure to get the current availability when submitting cart line items or executing other activities that require the availability ID.
Prerequisites
Credentials as described in Partner Center authentication. This scenario supports authentication with both standalone App and App+User credentials.
A product ID.
A SKU ID.
An availability ID.
C#
To get details of a specific availability, start by using the steps in Get a SKU by ID to get the interface for a specific SKU's operations. From the resulting interface, select the Availabilities property to obtain an interface with the available operations for Availabilities. After that, pass the availability ID to the ById() method to get the operations for that specific availability and then call Get() or GetAsync() to retrieve the availability details.
IAggregatePartner partnerOperations;
string countryCode;
string productId;
string skuId;
string availabilityId;
// Get the availability details.
var availability = partnerOperations.Products.ByCountry(countryCode).ById(productId).Skus.ById(skuId).Availabilities.ById(availabilityId).Get();
Java
The Partner Center Java SDK can be used to manage Partner Center resources. It's an open-source project maintained by the partner community and not officially supported by Microsoft. You can get help from the community or open an issue on GitHub if you experience a problem.
To get details of a specific availability, start by using the steps in Get a SKU by ID to get the interface for a specific SKU's operations. From the resulting interface, select the getAvailabilities function to obtain an interface with the available operations for Availabilities. After that, pass the availability ID to the byId() function to get the operations for that specific availability and then call the get() function to retrieve the availability details.
IAggregatePartner partnerOperations;
String countryCode;
String productId;
String skuId;
String availabilityId;
// Get the availability details.
Availability availability = partnerOperations.getProducts().byCountry(countryCode).byId(productId).getSkus().byId(skuId).getAvailabilities().byId(availabilityId).get();
PowerShell
The Partner Center PowerShell module can be used to manage Partner Center resources. It's an open-source project maintained by the partner community and not officially supported by Microsoft. You can get help from the community or open an issue on GitHub if you experience a problem.
To get details of a specific availability, execute the Get-PartnerProductAvailability and specify the AvailabilityId, CountryCode, ProductId, and SkuId parameters to retrieve the availability details.
Get-PartnerProductAvailability -Product $productId -SkuId $skuId -AvailabilityId $availabilityId
REST request
Request syntax
Method | Request URI |
---|---|
GET | {baseURL}/v1/products/{product-id}/skus/{sku-id}/availabilities/{availability-id}?country={country-code} HTTP/1.1 |
URI parameter
Use the following path and query parameters to get a specific availability using an availability ID.
Name | Type | Required | Description |
---|---|---|---|
product-id | string | Yes | A GUID formatted string that identifies the product. |
sku-id | string | Yes | A GUID formatted string that identifies the SKU. |
availability-id | string | Yes | A GUID formatted string that identifies the availability. |
country-code | string | Yes | A country/region ID. |
Request headers
For more information, see Partner Center REST headers.
Request body
None.
Request example
GET http://api.partnercenter.microsoft.com/v1/products/DZH318Z0BQ3Q/skus/0001/availabilities/DZH318XZXPHL?country=US HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 2e12a576-ded5-437e-a5ec-dbfbcbd1624c
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
X-Locale: en-US
MS-PartnerCenter-Client: Partner Center .NET SDK
Host: api.partnercenter.microsoft.com
Important
As of June 2023, the latest Partner Center .NET SDK release 3.4.0 is now archived. You can download the SDK release from GitHub, along with a readme file that contains useful information.
Partners are encouraged to continue to use the Partner Center REST APIs.
REST response
If successful, the response body contains an Availability resource.
Response success and error codes
Each response comes with an HTTP status code that indicates success or failure and additional debugging information. Use a network trace tool to read this code, error type, and additional parameters. For the full list, see Partner Center error codes.
This method returns the following error codes:
HTTP Status Code | Error code | Description |
---|---|---|
404 | 400013 | Product was not found. |
404 | 400018 | SKU was not found. |
404 | 400019 | Availability not found. This error can occur when checking out a cart. Partners that get this error should issue a new GET to ensure they have the current availability ID and retry the cart check out. |
Response example for Azure VM reservations (Azure plan)
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: 2e12a576-ded5-437e-a5ec-dbfbcbd1624c,2e12a576-ded5-437e-a5ec-dbfbcbd1624c
X-Locale: en-US,en-US
X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcbWFtZW5kZVxkZXZcZHBzLXJwZVxSUEUuUGFydG5lci5TZXJ2aWNlLkNhdGFsb2dcV2ViQXBpc1xDYXRhbG9nU2VydmljZS5WMi5XZWJcdjFccHJvZHVjdHNcRFpIMzE4WjBCUTNRXHNrdXNcMDAwMVxhdmFpbGFiaWxpdGllc1xEWkgzMThaMEhNS1E=?=
X-Powered-By: ASP.NET
Date: Wed, 14 Mar 2018 22:19:43 GMT
Content-Length: 440
{
"id": "DZH318XZXPHL",
"productId": "DZH318Z0BQ3Q",
"skuId": "0001",
"catalogItemId": "DZH318Z0BQ3Q:0001:DZH318XZXPHL",
"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/DZH318XZXPHL?country=US",
"method": "GET",
"headers": []
}
}
}
Response example for new commerce license-based services
Note
The new commerce experiences for license-based services include many new capabilities and are available to all Cloud Solution Provider (CSPs). For more information, see new commerce experiences overview.
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: 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"
}
]
}
]
},
…
],
"product": { ... },
"sku": { ... },
"links": {
"self": {
"uri": "/products/CFQ7TTC0LH18/skus/0001/availabilities/CFQ7TTC0K971?country=US",
"method": "GET",
"headers": []
}
}
}