इसके माध्यम से साझा किया गया


Get a list of products (by country/region)

Applies to: Partner Center | Partner Center operated by 21Vianet | Partner Center for Microsoft Cloud for US Government

You can use the following methods to get a collection of products available in a particular country/region.

Prerequisites

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

  • A country/region.

C#

To get a list of products:

  1. Use your IAggregatePartner.Products collection to select the country/region by using the ByCountry() method.

  2. Select the catalog view using the ByTargetView() method.

  3. (Optional) Select the reservation scope using the ByReservationScope() method.

  4. (Optional) Select the target segment using the ByTargetSegment() method.

  5. Call the Get() or GetAsync() method to return the collection.

IAggregatePartner partnerOperations;

// Get the products for the specified catalog view.
ResourceCollection<Products> products = partnerOperations.Products.ByCountry("US").ByTargetView("MicrosoftAzure").Get();

// Get the products filtered by target view and target segment.
ResourceCollection<Products> products = partnerOperations.Products.ByCountry("US").ByTargetView("MicrosoftAzure").ByTargetSegment("commercial").Get();

// Get the products for Azure reservations which are applicable to Microsoft Azure (MS-AZR-0145P) subscriptions only.
ResourceCollection<Product> products = partnerOperations.Products.ByCountry("US").ByTargetView("AzureReservations").Get();

// Get the products for Azure reservations which are applicable to Azure plans only.
ResourceCollection<Product> products = partnerOperations.Products.ByCountry("US").ByTargetView("AzureReservations").ByReservationScope("AzurePlan").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 a list of products:

  1. Use your IAggregatePartner.getProducts function to select the country by using the byCountry() function.

  2. Select the catalog view using the byTargetView() function.

  3. (Optional) Select the target segment using the byTargetSegment() function.

  4. Call the get() function to return the collection.

// IAggregatePartner partnerOperations;

// Get the products for the specified catalog view.
ResourceCollection<Products> products = partnerOperations.getProducts().byCountry("US").byTargetView("Azure").get();

// Get the products filtered by target view and target segment.
ResourceCollection<Products> products = partnerOperations.getProducts().byCountry("US").byTargetView("Azure").byTargetSegment("commercial").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 a list of products:

  1. Execute the Get-PartnerProduct command.

  2. Select the catalog by specifying the Catalog parameter.

  3. (Optional) Select the target segment by specifying the Segment parameter.

Get-PartnerProduct -Catalog 'Azure' -Segment 'commercial'

REST request

Request syntax

Method Request URI
GET {baseURL}/v1/products?country={country}&targetView={targetView}&targetSegment={targetSegment} HTTP/1.1

URI parameters

Use the following path and query parameters to get a list of products.

Name Type Required Description
country string Yes The country/region ID.
targetView string Yes Identifies the target view of the catalog. The supported values are:

Azure, which includes all Azure items

AzureReservations, which includes all Azure reservation items

AzureReservationsVM, which includes all virtual machine (VM) reservation items

AzureReservationsSQL, which includes all SQL reservation items

AzureReservationsCosmosDb, which includes all Cosmos database reservation items

MicrosoftAzure, which includes items for Microsoft Azure subscriptions (MS-AZR-0145P) and Azure plans

OnlineServices, which includes all online service items such as traditional license-based services and new commerce license-based services.

Software, which includes all software items

SoftwareSUSELinux, which includes all software SUSE Linux items

SoftwarePerpetual, which includes all perpetual software items

SoftwareSubscriptions, which includes all software subscription items

SpecializedOffers, which includes specialized offers that have been made available to some partners

MarketplaceSaaS, which includes all commercial marketplace offers published by Independent Software Vendors (ISVs)
targetSegment string No Identifies the target segment. The view for different target audiences. The supported values are:

commercial
education
government
nonprofit
reservationScope string No When querying for a list of products for Azure Reservations, specify reservationScope=AzurePlan to get a list of products that are applicable to Azure plans. Exclude this parameter to get a list of products for Azure reservations, which are applicable to Microsoft Azure (MS-AZR-0145P) subscriptions.

Request headers

For more information, see Partner Center REST headers.

Request body

None.

Request examples

Products by country

Follow this example to get a list of products by country for Microsoft Azure (MS-AZR-0145P) subscriptions and Azure plans.

GET https://api.partnercenter.microsoft.com/v1/products?country=US&targetView=MicrosoftAzure HTTP/1.1
Authorization: Bearer
Accept: application/json
MS-RequestId: 031160b2-b0b0-4d40-b2b1-aaa9bb84211d
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd

Azure VM reservations (Azure plan)

Follow this example to get a list of products by country for Azure VM reservations that are applicable to Azure plans.

GET https://api.partnercenter.microsoft.com/v1/products?country=US&targetView=AzureAzureReservationsVM&reservationScope=AzurePlan HTTP/1.1
Authorization: Bearer
Accept: application/json
MS-RequestId: 031160b2-b0b0-4d40-b2b1-aaa9bb84211d
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd

Azure VM reservations for Microsoft Azure (MS-AZR-0145P) subscriptions

Follow this example to get a list of products by country for Azure VM reservations that are applicable to Microsoft Azure (MS-AZR-0145P) subscriptions.

GET https://api.partnercenter.microsoft.com/v1/products?country=US&targetView=AzureReservationsVM HTTP/1.1
Authorization: Bearer
Accept: application/json
MS-RequestId: 031160b2-b0b0-4d40-b2b1-aaa9bb84211d
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd

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.

Follow this example to get a list of products by country for new commerce license-based services as part of the new commerce experience technical preview. New commerce license-based services will be identified by ID and displayNames values of OnlineServicesNCE. See response example below.

GET https://api.partnercenter.microsoft.com/v1/products?country=US&targetView=OnlineServices HTTP/1.1
Authorization: Bearer
Accept: application/json
MS-RequestId: 031160b2-b0b0-4d40-b2b1-aaa9bb84211d
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd

REST response

If successful, the response body contains a collection of Product resources.

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
403 400030 Access to the requested targetSegment is not allowed.
403 400036 Access to the requested targetView is not allowed.

Response example for Azure VM reservations (Azure plan)

{
    "totalCount": 19,
    "items": [
        {
            "id": "DZH318Z0BQ3Q",
            "title": "Virtual Machines DSv2 Series",
            "description": "Dsv2-series instances are the latest generation of D-series instances that will carry more powerful CPUs which are on average about 35% faster than D-series instances, and carry the same memory and disk configurations as the D-series. Dsv2-series instances are based on the latest generation 2.4 GHz Intel Xeon® E5-2673 v3 (Haswell) processor, and with Intel Turbo Boost Technology 2.0 can go to 3.2 GHz.",
            "productType": {
                "id": "Azure",
                "displayName": "Azure",
                "subType": {
                "id": "VirtualMachines",
                "displayName": "VirtualMachines"
                }
            },
            "isMicrosoftProduct": true,
            "publisherName": "Microsoft",
            "links": {
                "skus": {
                    "uri": "/products/DZH318Z0BQ3Q/skus?country=US",
                    "method": "GET",
                    "headers": []
                },
                "self": {
                    "uri": "/products/DZH318Z0BQ3Q?country=US",
                    "method": "GET",
                    "headers": []
                }
            }
        },
        ...
    ],
    "links": {
        "self": {
            "uri": "/products?country=US&targetView=Azure",
            "method": "GET",
            "headers": []
        }
    },
    "attributes": {
        "objectType": "Collection"
    }
}

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.

{
  "totalCount": 19,
  "items": [{
      "id": "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.",
      "productType": {
        "id": "OnlineServicesNCE",
        "displayName": "OnlineServicesNCE"
      },
      "isMicrosoftProduct": true,
      "publisherName": "Microsoft Corporation",
      "links": {
        "skus": {
          "uri": "/products/CFQ7TTC0LH18/skus?country=US",
          "method": "GET",
          "headers": []
        },
        "self": {
          "uri": "/products/CFQ7TTC0LH18?country=US",
          "method": "GET",
          "headers": []
        }
      }
    },
    ...
  ],
  "links": {
    "self": {
      "uri": "/products?country=US&targetView=OnlineServices",
      "method": "GET",
      "headers": []
    }
  },
  "attributes": {
    "objectType": "Collection"
  }
}