获取客户接受 Microsoft 客户协议的确认

适用于:合作伙伴中心

不适用于:由世纪互联运营的合作伙伴中心 | Microsoft Cloud for US Government 合作伙伴中心

协议资源目前仅在 Microsoft 公有云中受合作伙伴中心支持。

本文介绍如何检索客户接受Microsoft 客户协议的确认。

先决条件

  • 如果使用合作伙伴中心 .NET SDK,则需要版本 1.14 或更高版本。

    重要

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

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

  • 合作伙伴中心身份验证中所述的凭据。 此方案仅支持“应用 + 用户”身份验证。

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

.NET

检索以前提供的客户接受确认信息:

  • 使用 IAggregatePartner.Customers 集合并调用具有指定客户标识符的 ById 方法。

  • 通过调用 ByAgreementType 方法提取 Agreements 属性并筛选结果以Microsoft 客户协议。

  • 调用 GetGetAsync 方法。

// IAggregatePartner partnerOperations;
// string selectedCustomerId;

string agreementType = "MicrosoftCustomerAgreement";

var customerAgreements = partnerOperations.Customers.ById(selectedCustomerId).Agreements.ByAgreementType(agreementType).Get();

可以在控制台测试应用项目的 GetCustomerAgreements中找到完整的示例。

REST 请求

检索以前提供的客户接受确认:

  1. 创建 REST 请求以检索 客户的协议 集合。

  2. 使用 agreementType 查询参数将结果的范围限定为仅Microsoft 客户协议。

请求语法

使用以下请求语法:

方法 请求 URI
GET {baseURL}/v1/customers/{customer-tenant-id}/agreements?agreementType={agreement-type} HTTP/1.1

URI 参数

可以将以下 URI 参数用于请求:

名称 类型​​ 必需 说明
customer-tenant-id GUID 该值是 GUID 格式的 CustomerTenantId ,可用于指定客户。
agreement-type string 此参数返回所有协议元数据。 使用此参数将查询响应的范围限定为特定的协议类型。 支持的值包括:

仅包含 MicrosoftCloudAgreement 类型的协议元数据的 MicrosoftCloudAgreement。

仅包含 MicrosoftCustomerAgreement 类型的协议元数据的 MicrosoftCustomerAgreement。

* 返回所有协议元数据。 (除非代码具有处理意外协议类型所需的逻辑,否则请勿使用 *

注意: 如果未指定 URI 参数,则查询默认为 MicrosoftCloudAgreement 以实现向后兼容性。 Microsoft 随时可能会引入具有新协议类型的协议元数据。

请求标头

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

请求正文

无。

请求示例

GET https://api.partnercenter.microsoft.com/v1/customers/14876998-c0dc-46e6-9d0c-65a57a6c32ec/agreements?agreementType=MicrosoftCustomerAgreement HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 94e4e214-6b06-4fb7-96d1-94d559f9b47f
MS-CorrelationId: ab993325-1605-4cf4-bac4-fb584142a31b

REST 响应

如果成功,此方法在响应正文中返回协议资源的集合

响应的成功和错误代码

每个响应都有一个 HTTP 状态代码,指示成功或失败和其他调试信息。

使用网络跟踪工具读取此代码、错误类型和其他参数。 如需完整列表,请参阅合作伙伴中心 REST 错误代码

响应示例

HTTP/1.1 200 OK
Content-Length: 620
Content-Type: application/json
MS-RequestId: 94e4e214-6b06-4fb7-96d1-94d559f9b47f
MS-CorrelationId: ab993325-1605-4cf4-bac4-fb584142a31b
{
    "totalCount": 2,
    "items":
    [
        {
            "primaryContact":
            {
                "firstName":"Tania",
                "lastName":"Carr",
                "email":"SomeEmail@example.com"
                "phoneNumber":"1234567890"
            },
            "templateId":"117a77b0-9360-443b-8795-c6dedc750cf9",
            "dateAgreed":"2019-08-26T00:00:00",
            "type":"MicrosoftCustomerAgreement",
            "agreementLink":"https://aka.ms/customeragreement"
        },
        {
            "primaryContact":
            {
                "firstName":"Tania",
                "lastName":"Carr",
                "email":"SomeEmail@example.com"
                "phoneNumber:"1234567890"
            },
            "templateId":"117a77b0-9360-443b-8795-c6dedc750cf9",
            "dateAgreed":"2019-08-27T00:00:00",
            "type":"MicrosoftCustomerAgreement",
            "agreementLink":"https://aka.ms/customeragreement"
        }
    ]
}