您可以使用 ProductUpgradeRequest 資源創建產品升級實體,以將客戶升級到給定的產品系列(例如,Azure 計劃)。
先決條件
合作夥伴中心身份驗證中所述的憑證。 此案例支援使用App+User認證進行驗證。 搭配合作夥伴中心 API 使用 App+使用者驗證時,請遵循 安全的應用程式模型。
客戶識別碼 (
customer-tenant-id)。 如果您不知道客戶的標識碼,您可以在 合作夥伴中心 中選取 [客戶] 工作區,然後從客戶清單中找到該客戶,接著選取 [帳戶]。 在客戶的 [帳戶] 頁面上,在 [客戶帳戶資訊] 區段中尋找 Microsoft ID。 Microsoft ID 與客戶 ID (customer-tenant-id) 相同。要將客戶升級到的產品系列。
C#
若要將客戶升級到 Azure 計劃,請執行以下作:
建立 ProductUpgradesRequest 物件,並將客戶標識碼和 “Azure” 指定為產品系列。
使用 IAggregatePartner.ProductUpgrades 集合。
調用 Create 方法並傳入 ProductUpgradesRequest 物件,該物件將返回 位置標頭 字串。
從可用於查詢升級狀態的location標頭字串中提取 upgrade-id。
// IAggregatePartner partnerOperations;
string selectedCustomerId = "58e2af4f-0ad3-4688-8744-be2357cd939a";
string selectedProductFamily = "Azure";
var productUpgradeRequest = new ProductUpgradesRequest
{
CustomerId = selectedCustomerId,
ProductFamily = selectedProductFamily
};
var productUpgradeLocationHeader = partnerOperations.ProductUpgrades.Create(productUpgradeRequest);
var upgradeId = Regex.Split(productUpgradeLocationHeader, "/")[1];
REST 要求
請求語法
| 方法 | 請求網址識別碼 (URI) |
|---|---|
| 貼文 | {baseURL}/v1/productupgrades HTTP/1.1 |
請求標頭
如需詳細資訊,請參閱合作夥伴中心 REST 標頭。
請求主體
請求正文必須包含 ProductUpgradeRequest 資源。
範例請求
POST https://api.partnercenter.microsoft.com/v1/productupgrades HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: c245d5f2-1de3-4ae0-9e42-95e38e3cb8ff
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
X-Locale: en-US
MS-PartnerCenter-Application: Partner Center .NET SDK Samples
Content-Type: application/json
Host: api.partnercenter.microsoft.com
Content-Length: 340
Expect: 100-continue
Connection: Keep-Alive
{
"customerId": "4c721420-72ad-4708-a0a7-371a2f7b0969",
"productFamily": "Azure"
}
這很重要
自 2023 年 6 月起,最新的合作夥伴中心 .NET SDK 3.4.0 版現已封存。 您可以從 GitHub 下載 SDK 發行版本,還有包含實用資訊的自述檔。
鼓勵合作夥伴繼續使用 合作夥伴中心 REST API。
REST 響應
如果成功,回應將包含一個 Location 標頭,該標頭具有可用於檢索產品升級狀態的 URI。 儲存此 URI 以與其他相關的 REST API 搭配使用。
回應成功和錯誤碼
每個回應都有一個 HTTP 狀態代碼,指出成功或失敗和其他偵錯資訊。 請使用網路追蹤工具來讀取此錯誤碼、錯誤類型和其他參數。 如需完整清單,請參閱合作夥伴中心的 REST 錯誤碼。
回應範例
HTTP/1.1 202 Accepted
Content-Length: 0
Location: productUpgrades/42d075a4-bfe7-43e7-af6d-7c68a57edcb4
MS-CorrelationId: bbbb1111-cc22-3333-44dd-555555eeeeee
MS-RequestId: cb82f7d6-f0d9-44d4-82f9-f6eee6e68390
MS-CV: iqOqN0FnaE2y0HcD.0
MS-ServerId: 030020525
Date: Thu, 28 Sep 2019 20:35:35 GMT