获取产品列表(按国家/地区)

适用于:合作伙伴中心 | 由世纪互联运营的合作伙伴中心 | Microsoft Cloud for US Government 合作伙伴中心

可以使用以下方法获取特定国家/地区可用的产品集合。

先决条件

C#

获取产品列表:

  1. 使用 IAggregatePartner.Products 集合通过 ByCountry() 方法选择国家/地区。

  2. 使用 ByTargetView() 方法选择目录视图。

  3. (可选)使用 ByReservationScope() 方法选择预留范围。

  4. (可选)使用 ByTargetSegment() 方法选择目标段。

  5. 调用 Get()GetAsync() 方法以返回集合。

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

合作伙伴中心 Java SDK 可用于管理合作伙伴中心资源。 它是由合作伙伴社区维护的开源项目,不受 Microsoft 正式支持。 如果遇到问题,可以从社区获取帮助在 GitHub 上创建问题

获取产品列表:

  1. 使用 IAggregatePartner.getProducts 函数通过 byCountry() 函数选择国家/地区。

  2. 使用 byTargetView() 函数选择目录视图。

  3. (可选)使用 byTargetSegment() 函数选择目标段。

  4. 调用 get() 函数以返回集合。

// 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

合作伙伴中心 PowerShell 模块可用于管理合作伙伴中心资源。 它是由合作伙伴社区维护的开源项目,不受 Microsoft 正式支持。 如果遇到问题,可以从社区获取帮助在 GitHub 上创建问题

获取产品列表:

  1. 执行 Get-PartnerProduct 命令。

  2. 通过指定 Catalog 参数选择目录

  3. (可选)通过指定 Segment 参数选择目标段。

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

REST 请求

请求语法

方法 请求 URI
GET {baseURL}/v1/products?country={country}&targetView={targetView}&targetSegment={targetSegment} HTTP/1.1

URI 参数

使用以下路径和查询参数获取产品列表。

名称 类型​​ 必需 说明
country string 国家/地区 ID。
targetView string 标识目录的目标视图。 支持的值包括:

Azure,其中包括所有 Azure 项

AzureReservations,其中包括所有 Azure 预留项

AzureReservationsVM,其中包括所有虚拟机(VM)预留项

AzureReservationsSQL,其中包括所有 SQL 预留项

AzureReservationsCosmosDb,其中包括所有 Cosmos 数据库预留项

MicrosoftAzure,其中包括 Microsoft Azure 订阅(MS-AZR-0145P)和 Azure 计划的项目

OnlineServices,其中包括所有联机服务项目,例如基于许可证的传统服务和基于许可证的新商业服务。

软件,包括所有软件项

SoftwareSU标准版Linux,其中包括所有软件 SU标准版 Linux 项

SoftwarePerpetual,其中包括所有永久性软件项

SoftwareSubscriptions,其中包括所有软件订阅项

SpecializedOffers,其中包括已提供给某些合作伙伴的专用产品/服务

MarketplaceSaaS,其中包括独立软件供应商(ISV)发布的所有商业市场产品/服务
targetSegment string 标识目标段。 不同目标受众的视图。 支持的值包括:

商业
education
government
公益性
reservationScope string 查询 Azure 预留的产品列表时,请指定 reservationScope=AzurePlan 获取适用于 Azure 计划的产品列表。 排除此参数以获取适用于 Microsoft Azure(MS-AZR-0145P)订阅的产品列表。

请求标头

有关详细信息,请参阅合作伙伴中心 REST 标头

请求正文

无。

请求示例

产品(按国家/地区)

按照此示例获取 Microsoft Azure(MS-AZR-0145P)订阅和 Azure 计划的国家/地区的产品列表。

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: 7c1f6619-c176-4040-a88f-2c71f3ba4533

Azure VM 预留(Azure 计划)

按照此示例获取适用于 Azure 计划的 Azure VM 预留的国家/地区的产品列表。

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: 7c1f6619-c176-4040-a88f-2c71f3ba4533

Microsoft Azure 的 Azure VM 预留(MS-AZR-0145P)订阅

按照此示例获取适用于 Microsoft Azure(MS-AZR-0145P)订阅的 Azure VM 预留国家/地区的产品列表。

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: 7c1f6619-c176-4040-a88f-2c71f3ba4533

基于许可证的新服务

注意

基于许可证的服务的新商业体验涵盖许多新功能,可供所有云解决方案提供商 (CSP) 使用。 有关详细信息,请参阅新商业体验概述

按照以下示例,获取基于新商业许可证的服务的国家/地区的产品列表,作为新商业体验技术预览的一部分。 新的基于商业许可证的服务将由 OnlineServicesNCEID 和 displayNames 值标识。 请参阅下面的响应示例。

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: 7c1f6619-c176-4040-a88f-2c71f3ba4533

REST 响应

如果成功,响应正文将包含 Product 资源的集合

响应的成功和错误代码

每个响应都带有一个 HTTP 状态代码,用于指示成功或失败以及其他调试信息。 请使用网络跟踪工具来读取此代码、错误类型和其他参数。 有关完整列表,请参阅 合作伙伴中心错误代码

此方法返回以下错误代码:

HTTP 状态代码 错误代码 说明
403 400030 不允许访问请求的 targetSegment。
403 400036 不允许访问请求的目标视图。

Azure VM 预留的响应示例(Azure 计划)

{
    "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"
    }
}

基于许可证的新服务的响应示例

注意

基于许可证的服务的新商业体验涵盖许多新功能,可供所有云解决方案提供商 (CSP) 使用。 有关详细信息,请参阅新商业体验概述

{
  "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"
  }
}