获取产品列表(按国家/地区)
适用于:合作伙伴中心|由世纪互联运营的合作伙伴中心|适用于Microsoft Cloud for US Government的合作伙伴中心
可以使用以下方法获取特定国家/地区可用的产品集合。
必备条件
合作伙伴中心身份验证中所述的凭据。 此方案支持使用独立应用和 App+用户凭据进行身份验证。
一个国家/ 地区。
C#
获取产品列表:
使用 IAggregatePartner.Products 集合使用 ByCountry () 方法选择国家/地区。
使用 ByTargetView () 方法选择目录视图。
(可选) 使用 ByReservationScope () 方法选择预留范围。
(可选) 使用 ByTargetSegment () 方法选择目标段。
调用 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 上创建问题。
获取产品列表:
使用 IAggregatePartner.getProducts 函数使用 byCountry () 函数选择国家/地区。
使用 byTargetView () 函数选择目录视图。
(可选) 使用 byTargetSegment () 函数选择目标段。
调用 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 上创建问题。
获取产品列表:
执行 Get-PartnerProduct 命令。
通过指定 Catalog 参数选择目录。
(可选) 通过指定 Segment 参数选择目标段。
Get-PartnerProduct -Catalog 'Azure' -Segment 'commercial'
REST 请求
请求语法
| 方法 | 请求 URI |
|---|---|
| GET | {baseURL}/v1/products?country={country}&targetView={targetView}&targetSegment={targetSegment} HTTP/1.1 |
URI 参数
使用以下路径和查询参数获取产品列表。
| 名称 | 类型 | 必需 | 说明 |
|---|---|---|---|
| country | 字符串 | 是 | 国家/地区 ID。 |
| targetView | 字符串 | 是 | 标识目录的目标视图。 支持的值包括: Azure,其中包括所有 Azure 项 AzureReservations,其中包括所有 Azure 预留项 AzureReservationsVM,其中包括所有虚拟机 (VM) 预留项 AzureReservationsSQL,其中包括所有 SQL 预留项 AzureReservationsCosmosDb,其中包括所有 Cosmos 数据库预留项 MicrosoftAzure,其中包括 Microsoft Azure 订阅的项 (MS-AZR-0145P) 和 Azure 计划 OnlineServices,包括所有联机服务项目,例如传统的基于许可证的服务以及基于新商业许可证的服务。 软件,包括所有软件项 SoftwareSUSELinux,其中包括所有软件 SUSE Linux 项 SoftwarePerpetual,其中包括所有永久性软件项目 SoftwareSubscriptions,其中包括所有软件订阅项 SpecializedOffers,其中包括已提供给某些合作伙伴的专用产品/服务 MarketplaceSaaS,其中包括独立软件供应商发布的所有商业市场产品/服务 (ISV) |
| targetSegment | 字符串 | 否 | 标识目标段。 不同目标受众的视图。 支持的值包括: 商业 教育 政府 公益性 |
| reservationScope | 字符串 | 否 | 查询 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 (MS-AZR-0145P) 订阅的 Azure VM 预留
按照以下示例获取适用于 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) 使用。 有关详细信息,请参阅新商务体验概述。
按照以下示例,在新的商业体验技术预览版中,按国家/地区获取基于新商业许可证的服务的产品列表。 新的基于商业许可证的服务将由 OnlineServicesNCE 的 ID 和 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 响应
如果成功,响应正文包含 产品 资源的集合。
响应的成功和错误代码
每个响应都带有一个 HTTP 状态代码,用于指示成功或失败以及其他调试信息。 请使用网络跟踪工具来读取此代码、错误类型和其他参数。 有关完整列表,请参阅 合作伙伴中心错误代码。
此方法返回以下错误代码:
| HTTP 状态代码 | 错误代码 | 说明 |
|---|---|---|
| 403 | 400030 | 不允许访问所请求的目标Segment。 |
| 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"
}
}