获取客户的公司简介

适用于:合作伙伴中心 |由世纪互联运营的合作伙伴中心 |美国政府Microsoft云合作伙伴中心

获取客户的公司简介。

先决条件

  • 合作伙伴中心身份验证中所述的凭据。 此方案仅支持使用 App+User 凭据进行身份验证。

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

重要

如果合作伙伴在客户租户上没有 DAP 或 GDAP 访问权限,则获取客户公司配置文件 API 调用不会返回响应中的以下属性。

  • 公司简介地址
  • CompanyProfileEmail
  • CustomDomain 要获取 CompanyProfileAddress 和 CompanyProfile 电子邮件,至少需要具有下列 GDAP 角色之一。
  • 全局管理员
  • 目录编辑器
  • 全局读取者

至少需要以下 GDAP 角色之一才能获取 CustomDomain。

  • 域管理员
  • 目录读取器
  • 全局管理员
  • 全局读取者
  • 混合标识管理员

若要了解有关角色的详细信息,请参阅 Microsoft内置角色

C#(编程语言)

若要获取客户的公司档案,请使用客户 ID 调用 IAggregatePartner.Customers.ById 方法来识别客户。 然后,从 Profiles 属性中获取客户的 ICustomerProfileCollection 接口,以便访问它的 Company 属性。 接下来,从 ICustomerProfileCollection.Company 属性获取 ICustomerReadonlyProfile 接口,并调用其 Get()GetAsync() 方法。

// IAggregatePartner partnerOperations;
// string customerId;

var companyProfile = partnerOperations.Customers.ById(customerId).Profiles.Company.Get();

示例下载合作伙伴中心 SDK项目:PartnerSdk.FeatureSamples :GetCustomerCompanyProfile.cs

爪哇岛

合作伙伴中心 Java SDK 可用于管理合作伙伴中心资源。 它是由合作伙伴社区维护的开源项目,不受Microsoft正式支持。 如果遇到问题,可以 从社区 获取帮助,或 在 GitHub 上提出问题。

若要获取客户的公司简介,请使用客户标识符调用 IAggregatePartner.getCustomers().byId 函数。 然后,从 [getProfiles] 函数获取客户的 ICustomerProfileCollection 接口,以便访问其 Company 属性。 接下来,从 ICustomerProfileCollection.getCompany 函数获取 ICustomerReadonlyProfile 接口,并调用 get 函数。

// IAggregatePartner partnerOperations;
// String customerId;

CustomerCompanyProfile companyProfile = partnerOperations.getCustomers().byId(customerId).getProfiles().getCompany().get();

REST 请求

请求语法

方法 请求 URI
GET {baseURL}/v1/customers/{customer-tenant-id}/profiles/company HTTP/1.1

URI 参数

使用以下查询参数获取公司简介。

名字 类型 必选 说明
customer-tenant-id guid Y 此值是 GUID 格式的 customer-tenant-id,允许经销商筛选属于该经销商的给定客户的结果。

请求头

如需了解更多信息,请参阅 合作伙伴中心 REST 标头

请求主体

没有

请求示例

GET https://api.partnercenter.microsoft.com/v1/customers/aaaabbbb-0000-cccc-1111-dddd2222eeee/profiles/company HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 0b6f039c-e4b5-4b9e-bdac-b39077bb60da
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
X-Locale: en-US
Host: api.partnercenter.microsoft.com
Connection: Keep-Alive

REST 响应

如果成功,此方法在响应正文中返回信息。

成功响应和错误代码

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

响应示例

HTTP/1.1 200 OK
Content-Length: 488
Content-Type: application/json; charset=utf-8
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: 0b6f039c-e4b5-4b9e-bdac-b39077bb60da
MS-CV: /e74N8OrkE29ycwZ.0
MS-ServerId: 101112202
Date: Wed, 04 Jan 2017 19:48:51 GMT

{
    "tenantId": "aaaabbbb-0000-cccc-1111-dddd2222eeee",
    "domain": "dtdemocspcustomer005.onmicrosoft.com",
    "companyName": "DT Demo CSP Customer 005",
    "address": {
        "country": "US",
        "region": "WA",
        "city": "Redmond ",
        "addressLine1": "1 Microsoft Way",
        "postalCode": "98052",
        "phoneNumber": "4155551212"
    },
    "email": "daniel@hotmail.com.tw",
    "links": {
        "self": {
            "uri": "/customers/aaaabbbb-0000-cccc-1111-dddd2222eeee/profiles/company",
            "method": "GET",
            "headers": []
        }
    },
    "attributes": {
        "objectType": "CustomerCompanyProfile"
    }
}