Share via


取得客戶的公司設定檔

適用于:合作夥伴中心 |由 21Vianet 營運的合作夥伴中心 |美國政府適用的 Microsoft Cloud 合作夥伴中心

取得客戶的公司設定檔。

必要條件

  • 認證,如合作夥伴中心驗證所述。 此案例僅支援使用「應用程式+使用者」認證來進行驗證。

  • 客戶識別碼 (customer-tenant-id)。 如果您不知道客戶的識別碼,您可以在合作夥伴中心 查閱 從合作夥伴中心首頁選取 [客戶 ] 工作區。 從 [客戶] 清單中 選取客戶,然後選取 [ 帳戶 ]。 在客戶的 [帳戶] 頁面上,在 [客戶帳戶詳細資料] 區段中 尋找 Microsoft 識別碼 。 Microsoft 識別碼與客戶識別碼 (customer-tenant-id) 相同。

重要

如果合作夥伴沒有客戶租使用者的 DAP 存取權,取得客戶公司設定檔 API 呼叫將不會在回應中傳回下列屬性。 否則,它會傳迴響應範例中列出的所有屬性。

  • CompanyProfileAddress
  • CompanyProfileEmail
  • CustomDomain

C#

若要取得客戶的公司設定檔,請使用客戶識別碼來呼叫 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

合作夥伴中心 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 格式的客戶 租使用者識別碼 ,可讓轉銷商篩選屬於轉銷商之指定客戶的結果。

要求標頭

如需詳細資訊,請參閱合作夥伴中心 REST 標頭

要求本文

要求範例

GET https://api.partnercenter.microsoft.com/v1/customers/4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04/profiles/company HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 0b6f039c-e4b5-4b9e-bdac-b39077bb60da
MS-CorrelationId: ffa9174c-dbcb-47de-b70d-10e640a7f1b4
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: ffa9174c-dbcb-47de-b70d-10e640a7f1b4
MS-RequestId: 0b6f039c-e4b5-4b9e-bdac-b39077bb60da
MS-CV: /e74N8OrkE29ycwZ.0
MS-ServerId: 101112202
Date: Wed, 04 Jan 2017 19:48:51 GMT

{
    "tenantId": "4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04",
    "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/4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04/profiles/company",
            "method": "GET",
            "headers": []
        }
    },
    "attributes": {
        "objectType": "CustomerCompanyProfile"
    }
}