依照識別碼取得產品

使用產品識別碼取得指定的產品資源。

必要條件

  • 認證,如合作夥伴中心驗證所述。 此案例支援使用獨立應用程式和 App+使用者認證進行驗證。

  • 產品識別碼。

C#

若要依識別碼尋找特定產品,請使用您的 IAggregatePartner.Products 集合,使用 ByCountry () 方法選取國家/地區,然後呼叫 ById () 方法。 最後,呼叫 Get () GetAsync () 方法來傳回產品。

// IAggregatePartner partnerOperations;

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

Java

合作夥伴中心 JAVA SDK可用來管理合作夥伴中心資源。 它是由合作夥伴社群維護的開放原始碼專案,Microsoft 未正式支援。 如果您遇到問題,可以從社群取得協助在 GitHub 上提出問題

若要依識別碼尋找特定產品,請使用您的 IAggregatePartner.getProducts 函式,使用 byCountry () 函式選取國家/地區,然後呼叫 byId () 函式。 最後,呼叫 get () 函式以傳回產品。

// IAggregatePartner partnerOperations;

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

PowerShell

合作夥伴中心 PowerShell 模組可用來管理合作夥伴中心資源。 它是由合作夥伴社群維護的開放原始碼專案,Microsoft 未正式支援。 如果您遇到問題,可以從社群取得協助在 GitHub 上提出問題

若要依識別碼尋找特定產品,請執行 Get-PartnerProduct 命令並指定 ProductId 參數。 CountryCode參數是選項,如果未指定,則會使用與轉銷商相關聯的國家/地區。

Get-PartnerProduct -ProductId 'DZH318Z0BQ3Q'

REST 要求

要求的語法

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

URI 參數

使用下列路徑參數來取得指定的產品。

名稱 類型 必要 描述
product-id string Yes 識別產品的字串。
country 字串 Yes 國家/地區識別碼。

要求標頭

如需詳細資訊,請參閱合作夥伴中心 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": []
        }
    }
}