根据 ID 获取产品

使用产品 ID 获取指定的产品资源。

必备条件

C#

若要按 ID 查找特定产品,请使用 IAggregatePartner.Products 集合,使用 ByCountry () 方法选择国家/地区,然后调用 ById () 方法。 最后,调用 Get () GetAsync () 方法来返回产品。

// IAggregatePartner partnerOperations;

Product productDetail = partnerOperations.Products.ByCountry("US").ById("DZH318Z0BQ3Q").Get();

Java

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

若要按 ID 查找特定产品,请使用 IAggregatePartner.getProducts 函数,使用 byCountry () 函数选择国家/地区,然后调用 byId () 函数。 最后,调用 get () 函数以返回产品。

// IAggregatePartner partnerOperations;

Product productDetail = partnerOperations.getProducts().byCountry("US").byId("DZH318Z0BQ3Q").get();

PowerShell

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

若要按 ID 查找特定产品,请执行 Get-PartnerProduct 命令并指定 ProductId 参数。 CountryCode 参数是选项,如果未指定,则将使用与经销商关联的国家/地区。

Get-PartnerProduct -ProductId 'DZH318Z0BQ3Q'

REST 请求

请求语法

方法 请求 URI
GET {baseURL}/v1/products/{product-id}?country={country} HTTP/1.1

URI 参数

使用以下路径参数获取指定的产品。

名称 类型 必须 说明
product-id 字符串 标识产品的字符串。
country 字符串 国家/地区 ID。

请求标头

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

请求正文

无。

请求示例

GET https://api.partnercenter.microsoft.com/v1/products/{product-id}?country=US 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 状态代码 错误代码 说明
404 400013 找不到产品。

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

HTTP/1.1 200 OK
Content-Length: 1918
Content-Type: application/json
MS-CorrelationId: 7c1f6619-c176-4040-a88f-2c71f3ba4533
MS-RequestId: ac943950-ba3d-47a0-bd2a-c5617a7fefe8
Date: Tue, 23 Jan 2018 23:13:01 GMT

{
    "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": []
        }
    }
}

基于新商业许可证的产品的响应示例

注意

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

{
    "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": []
        }
    }
}