以异步方式更新客户的资格

异步汇报客户的资格。

合作伙伴可以将客户的资格异步更新为“Education”、“GovernmentCommunityCloud”或“StateOwnedEntity”。 无法设置其他值,例如“None”和“非营利组织”。

先决条件

  • 合作伙伴中心身份验证中所述的凭据。 此方案只支持使用应用凭据和用户凭据进行身份验证。

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

  • 仅对于政府社区云(GCC)资格:至少需要以下粒度委派管理员权限(GDAP)角色之一。 若要了解有关 GDAP 的详细信息,请浏览 MS Learn 文章,从 GDAP 简介开始

    • 目录读取者
    • 目录写入者
    • 许可证管理员
    • 用户管理员

C#

若要创建客户的“教育”资格,请先创建一个 CustomerQualificationRequest 类型对象,并指定 Education 资格类型和资格类型 EducationSegment以及 Website (可选)。

然后,使用客户标识符调用 IAggregatePartner.Customers.ById 方法。

然后使用 Qualification 属性检索 ICustomerQualification 接口。

最后,调用 CreateQualifications() 类型对象或 CreateQualificationsAsync()CustomerQualificationRequest 类型对象作为输入参数。

// Education
var eduRequestBody = new CustomerQualificationRequest 
{
    Qualification = "Education",
    EducationSegment = "K12", // could also be "HigherEducation"
    Website = "example.edu"
};

var eduCustomerQualification = partnerOperations.Customers.ById(existingCustomer.Id).Qualification.CreateQualifications(eduRequestBody);

// State Owned Entity
var soeRequestBody = new CustomerQualificationRequest 
{
    Qualification = "StateOwnedEntity"
};

var soeCustomerQualification = partnerOperations.Customers.ById(existingCustomer.Id).Qualification.CreateQualifications(soeRequestBody);

示例控制台示例应用项目:SdkSamples :CreateCustomerQualification.cs

若要在没有资格的情况下将客户的资格更新为 现有客户的 GovernmentCommunityCloud ,还需要合作伙伴包含客户的验证代码。

首先,创建类型 CustomerQualificationRequest 对象并指定 GovernmentCommunityCloud 限定类型和验证代码。

然后,使用客户标识符调用 IAggregatePartner.Customers.ById 方法。

然后使用 Qualification 属性检索 ICustomerQualification 接口。

最后,调用 CreateQualifications() 类型对象或 CreateQualificationsAsync()CustomerQualificationRequest 类型对象作为输入参数。

var gccRequestBody = new CustomerQualificationRequest 
{
    Qualification = "GovernmentCommunityCloud",
    ValidationCode = "<validation code>"
};

var gccCustomerQualification = partnerOperations.Customers.ById(existingCustomer.Id).Qualification.CreateQualifications(gccRequestBody);

示例控制台示例应用项目:SdkSamples :CreateCustomerQualificationWithGCC.cs

REST 请求

请求语法

方法 请求 URI
POST {baseURL}/v1/customers/{customer_tenant_id}/qualifications HTTP/1.1

URI 参数

使用以下查询参数更新限定。

名称 类型​​ 必需 说明
customer-tenant-id GUID 该值是 GUID 格式 的客户租户 ID ,允许经销商筛选属于经销商的给定客户的结果。

请求标头

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

请求正文

下表描述了请求正文中的限定对象。

properties 类型 必需 说明
资格授予 string CustomerQualification 枚举中的字符串值。

下表专门描述了教育资格的请求正文

properties 类型 必需 说明
资格授予 string 教育版
EducationSegment string K12,更高教育
Website string 教育实体的网站

如果资格为教育版,则教育部门是必填字段。

  • EducationSegment 的允许值为 K12HigherEducation
  • 网站仍然是一个可选字段,仅当资格是教育资格时才相关。 但是,强烈建议将其包括(如果可用/适用)

下表专门描述了 GovernmentCommunityCloud 资格的请求正文

properties 类型 必需 说明
资格授予 string GovernmentCommunityCloud
ValidationCode string 合作伙伴的 GCC 验证代码。 示例 - 123456

如果资格为 GovernmentCommunityCloud ,则 ValidationCode 是必填字段。

请求示例

POST https://api.partnercenter.microsoft.com/v1/customers/<customer-tenant-id>/qualifications HTTP/1.1
Accept: application/json
Content-Type: application/json
MS-CorrelationId: 7d2456fd-2d79-46d0-9f8e-5d7ecd5f8745
MS-RequestId: 037db222-6d8e-4d7f-ba78-df3dca33fb68

// SOE
{
    "qualification": "StateOwnedEntity"
}

// Education
{
    "qualification": "Education",
    "educationSegment": "HigherEducation", // could also be "K12"
    "website": "contoso.edu"
}

// GCC
{
    "qualification": "GovernmentCommunityCloud",
    "validationCode": "123456"
}

REST 响应

如果成功,此方法在响应正文中返回限定对象。 下面是对具有教育资格的客户(以前限定为 None)的 POST 呼叫示例

响应的成功和错误代码

每个响应都有一个 HTTP 状态代码,指示成功或失败和其他调试信息。 请使用网络跟踪工具来读取此代码、错误类型和其他参数。 有关完整列表,请参阅错误代码

响应示例

HTTP/1.1 201 CREATED
Content-Length: 29
Content-Type: application/json
MS-CorrelationId: 7d2456fd-2d79-46d0-9f8e-5d7ecd5f8745
MS-RequestId: 037db222-6d8e-4d7f-ba78-df3dca33fb68
{
    "qualification": "Education",
    "vettingStatus": "InReview",
    "vettingCreateDate": "2020-12-04T20:54:24Z" // UTC
}