Check inventory by resource type using Partner Center APIs

How to check the inventory for catalog items filtered by a specific resource type.

Prerequisites

  • Credentials as described in Partner Center authentication. This scenario supports authentication with both standalone App and App+User credentials.

  • One or more product IDs. Optionally, SKU IDs can also be specified.

  • A valid resourceType value (required). See Supported resource types for the full list of accepted values.

  • Any additional context needed for verifying the inventory of the SKUs referenced by the provided product/SKU IDs. These requirements might vary by type of product/SKU and can be determined from the SKU's InventoryVariables property.

REST request

Request syntax

Method Request URI
POST {baseURL}/v1/extensions/product/checkinventorybyresourcetype?country={country-code}&resourceType={resourceTypeValue} HTTP/1.1

URI parameters

Use the following query parameters to check inventory by resource type.

Name Type Required Description
country-code string Yes A country/region ID.
resourceTypeValue string Yes The resource type to filter inventory results. See Supported resource types for valid values.

Supported resource types

Resource type value Description
AppService App Service
Avs Azure VMware Solution
AzureDataExplorer Azure Data Explorer
AzureFiles Azure Files
Backup Azure Backup
BlockBlob Block Blob Storage
CopilotCredit Copilot Credit
CosmosDb Azure Cosmos DB
Databricks Azure Databricks
DataFactory Azure Data Factory
DedicatedHost Azure Dedicated Host
FabricCapacity Microsoft Fabric Capacity
FoundryAgent Foundry Agent
ManagedDisk Azure Managed Disk
MariaDB Azure Database for MariaDB
MDC Microsoft Defender for Cloud
MySql Azure Database for MySQL
Nutanix Nutanix
OpenAIPTU Azure OpenAI PTU
PostgreSql Azure Database for PostgreSQL
RedHat Red Hat
RedHatOsa Red Hat OpenShift on Azure
RedisCache Azure Cache for Redis
SapHana SAP HANA on Azure
Sentinel Microsoft Sentinel
SqlDatabases Azure SQL Databases
SqlDataWarehouse Azure SQL Data Warehouse
SuseLinux SUSE Linux
Synapse Azure Synapse Analytics
VirtualMachines Azure Virtual Machines
VMwareCloudSimple VMware CloudSimple

Request headers

For more information, see Partner Center REST headers.

Request body

The inventory request details, consisting of an InventoryCheckRequest resource containing one or more InventoryItem resources.

Ensure the Azure Subscription specified in the request body is registered and enabled to purchase Azure RIs. See Register a Subscription for details on the registration process.

Request example

POST https://api.partnercenter.microsoft.com/v1/extensions/product/checkinventorybyresourcetype?country=US&resourceType=VirtualMachines HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: d1b1981a-e088-4610-870a-eebec96d6bcd
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
X-Locale: en-US
Content-Type: application/json

{"TargetItems":[{"ProductId":"DZH318Z0BQ3P"}],"InventoryContext":{"customerId":"d6bf25b7-e0a8-4f2d-a31b-97b55cfc774d","azureSubscriptionId":"3A231FBE-37FE-4410-93FD-730D3D5D4C75","armRegionName":"Europe"}}

REST response

If successful, the response body contains a collection of InventoryItem objects populated with the restriction details, if any apply.

Note

If an input InventoryItem represents an item that could not be found in the catalog, or does not correspond to the specified resource type, it will not be included in the output collection.

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.

Response example

HTTP/1.1 200 OK
Content-Length: 1021
Content-Type: application/json; charset=utf-8
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: d1b1981a-e088-4610-870a-eebec96d6bcd
X-Locale: en-US
[
    {
        "productId": "DZH318Z0BQ3P",
        "skuId": "0039",
        "isRestricted": true,
        "restrictions": [
            {
                "reasonCode": "NotAvailableForSubscription",
                "description": "Restriction identified of type 'Location' with values 'japanwest'.",
                "properties": {
                    "type": "Location",
                    "values": "japanwest"
                }
            }
        ]
    },
    {
        "productId": "DZH318Z0BQ3P",
        "skuId": "0038",
        "isRestricted": false,
        "restrictions": []
    }
]