Get a customer's company profile

Applies to: Partner Center | Partner Center operated by 21Vianet | Partner Center for Microsoft Cloud for US Government

Gets the company profile of a customer.

Prerequisites

  • Credentials as described in Partner Center authentication. This scenario supports authentication with App+User credentials only.

  • A customer ID (customer-tenant-id). If you don't know the customer's ID, you can look it up in Partner Center. Select the Customers workspace from the Partner Center Home page. Select the customer from the Customer list, then select Account. On the customer's Account page, look for the Microsoft ID in the Customer Account details section. The Microsoft ID is the same as the customer ID (customer-tenant-id).

Important

The Get Customer Company Profile API call will not return the following attributes back in the response if the partner doesn't have DAP or GDAP access on the customer tenant.

  • CompanyProfileAddress
  • CompanyProfileEmail
  • CustomDomain At least one of the following GDAP roles is required to get the CompanyProfileAddress and CompanyProfile Email.
  • Global Administrator
  • Directory Writer
  • Global Reader

At least one of the following GDAP roles is required to get the CustomDomain.

  • Domain Administrator
  • Directory Readers
  • Global Administrator
  • Global Reader
  • Hybrid Identity Administrator

To learn more about the roles, see Microsoft Built-in Roles.

C#

To get the company profile for a customer, call the IAggregatePartner.Customers.ById method with the customer ID to identify the customer. Then get the customer's ICustomerProfileCollection interface from the Profiles property, in order to access its Company property. Next, get the ICustomerReadonlyProfile interface from the ICustomerProfileCollection.Company property, and call its Get() or GetAsync() methods.

// IAggregatePartner partnerOperations;
// string customerId;

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

Sample: Download the Partner Center SDK. Project: PartnerSdk.FeatureSamples Class: GetCustomerCompanyProfile.cs

Java

The Partner Center Java SDK can be used to manage Partner Center resources. It's an open-source project maintained by the partner community and not officially supported by Microsoft. You can get help from the community or open an issue on GitHub if you experience a problem.

To get the company profile for a customer, call the IAggregatePartner.getCustomers().byId function with the customer identifier to identify the customer. Then get the customer's ICustomerProfileCollection interface from the [getProfiles] function, in order to access its Company property. Next, get the ICustomerReadonlyProfile interface from the ICustomerProfileCollection.getCompany function, and call the get function.

// IAggregatePartner partnerOperations;
// String customerId;

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

REST request

Request syntax

Method Request URI
GET {baseURL}/v1/customers/{customer-tenant-id}/profiles/company HTTP/1.1

URI parameter

Use the following query parameter to get the company profile.

Name Type Required Description
customer-tenant-id guid Y The value is a GUID formatted customer-tenant-id that allows the reseller to filter the results for a given customer that belongs to the reseller.

Request headers

For more information, see Partner Center REST headers.

Request body

None

Request example

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 response

If successful, this method returns information in the response body.

Response success and error codes

Each response comes with an HTTP status code that indicates success or failure and additional debugging information. Use a network trace tool to read this code, error type, and additional parameters. For the full list, see Partner Center REST Error Codes.

Response example

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"
    }
}