获取客户的产品升级状态

可以使用 ProductUpgradeRequest 资源获取升级到新产品系列的状态。 将客户从 Microsoft Azure(MS-AZR-0145P)订阅升级到 Azure 计划时,此资源适用。 成功的请求返回 ProductUpgradesEligibility 资源。

先决条件

  • 合作伙伴中心身份验证中所述的凭据。 此方案支持使用应用凭据和用户凭据进行身份验证。 在 合作伙伴中心 API 中使用 App+User 身份验证时,请遵循安全应用模型

  • 客户 ID (customer-tenant-id)。 如果不知道客户的 ID,可以通过选择“客户”工作区,然后从客户列表中选择客户,然后选择“帐户”,在合作伙伴中心查找该 ID。 在客户的“帐户”页上,在“客户帐户信息”部分查找 Microsoft ID Microsoft ID 与客户 ID (customer-tenant-id) 相同。

  • 产品系列。

  • 升级请求的升级 ID。

C#

若要检查客户是否有资格升级到 Azure 计划:

  1. 创建 ProductUpgradesRequest 对象,并将客户标识符和“Azure”指定为产品系列。

  2. 使用 IAggregatePartner.ProductUpgrades 集合。

  3. 调用 ById 方法并传入 upgrade-id

  4. 调用 CheckStatus 方法并传入 ProductUpgradesRequest 对象,该对象将返回 ProductUpgradeStatus 对象。

// IAggregatePartner partnerOperations;

string selectedCustomerId = "58e2af4f-0ad3-4688-8744-be2357cd939a";

string selectedProductFamily = "azure";

var productUpgradeRequest = new ProductUpgradesRequest
{
    CustomerId = selectedCustomerId,
    ProductFamily = selectedProductFamily
};

ProductUpgradesStatus productUpgradeStatus = partnerOperations.ProductUpgrades.ById(selectedUpgradeId).CheckStatus(productUpgradeRequest);

if (productUpgradeEligibility.IsEligibile)
{
    ....
}

REST 请求

请求语法

方法 请求 URI
POST {baseURL}/v1/productUpgrades/{upgrade-id}/status HTTP/1.1

URI 参数

使用以下查询参数指定要为其获取产品升级状态的客户。

名称 Type 需要 说明
upgrade-id GUID 该值是 GUID 格式的升级标识符。 可以使用此标识符指定要跟踪的升级。

请求标头

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

请求正文

请求正文必须包含 ProductUpgradeRequest 资源。

请求示例

POST https://api.partnercenter.microsoft.com/v1/productupgrades/42d075a4-bfe7-43e7-af6d-7c68a57edcb4/status  HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: c245d5f2-1de3-4ae0-9e42-95e38e3cb8ff
MS-CorrelationId: e3f26e6a-044f-4371-ad52-0d91ce4200be
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"
  }
  "Attributes": {
  "ObjectType": "ProductUpgradeRequest"
  }
}

重要

截至 2023 年 6 月,最新的合作伙伴中心 .NET SDK 版本 3.4.0 现已存档。 可以从 GitHub 下载 SDK 版本,以及包含有用信息的自述文件

建议合作伙伴继续使用合作伙伴中心 REST API

REST 响应

如果成功,此方法在 正文中返回 ProductUpgradesEligibility 资源。

响应的成功和错误代码

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

响应示例

HTTP/1.1 200 Ok
Content-Length: 150
MS-CorrelationId: 772871a9-399b-4f3b-b8c7-38f550e4f22a
MS-RequestId: cb82f7d6-f0d9-44d4-82f9-f6eee6e68390
MS-CV: iqOqN0FnaE2y0HcD.0
MS-ServerId: 030020525
Date: Thu, 04 Oct 2019 20:35:35 GMT

{
    "id": "42d075a4-bfe7-43e7-af6d-7c68a57edcb4",
    "status": "Completed",
    "productFamily": "Azure",
    "lineItems": [
        {
            "sourceProduct": {
                "id": "b1beb621-3cad-4d7a-b360-62db33ce028e",
                "name": "AzureSubscription"
            },
            "targetProduct": {
                "id": "d231908e-31c1-de0e-027b-bc5ce11f09d9",
                "name": "Microsoft Azure plan"
            },
            "upgradedDate": "2019-08-29T23:47:28.8524555Z",
            "status": "Completed"
        }
    ]
}