Get a customer by ID
Applies to: Partner Center | Partner Center operated by 21Vianet | Partner Center for Microsoft Cloud for US Government
Gets a Customer resource that corresponds to a customer ID.
Prerequisites
Credentials as described in Partner Center authentication. This scenario supports app+user credentials or app-only authentication.
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 ID API call will not return the following attributes back in the response if the partner doesn't have DAP access on the customer tenant. Otherwise, it will return all the attributes listed in the response sample.
- CompanyProfileAddress
- CompanyProfileEmail
- CustomDomain
GDAP roles
You'll need at least one of the following GDAP roles to call Get a customer organization for CompanyProfileAddress, CompanyProfileEmail and Get a customer custom domain for CustomDomain:
- Directory Writer
- Global Reader
- Domain Administrator
C#
To get a customer by ID, use your IAggregatePartner.Customers collection, call the ById() method, then call the Get() or GetAsync() methods.
// IAggregatePartner partnerOperations;
// string customerIdToRetrieve;
Customer customerInfo = partnerOperations.Customers.ById(customerIdToRetrieve).Get();
Sample: Console test app. Project: PartnerSDK.FeatureSamples Class: CustomerInformation.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 a customer by ID, use your IAggregatePartner.getCustomers function, call the byId() function, then call the get() function.
// IAggregatePartner partnerOperations;
// String customerIdToRetrieve;
Customer customerInfo = partnerOperations.getCustomers().byId(customerIdToRetrieve).get();
PowerShell
The Partner Center PowerShell module 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 a customer by ID, execute the Get-PartnerCustomer command and specify the CustomerId parameter.
Get-PartnerCustomer -CustomerId '2ca7de6c-c05c-46b5-b689-32e53573a97a'
REST request
Request syntax
Method | Request URI |
---|---|
GET | {baseURL}/v1/customers/{customer-tenant-id} HTTP/1.1 |
URI parameter
Use the following query parameter to a specific customer.
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/<customer-tenant-id> HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: 74ca1db9-df92-41c6-a362-a16433b0542b
REST response
If successful, this method returns a Customer resource 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 Error Codes.
Response example
HTTP/1.1 200 OK
Content-Length: 1530
Content-Type: application/json; charset=utf-8
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: 74ca1db9-df92-41c6-a362-a16433b0542b
{
"id": "aaaabbbb-0000-cccc-1111-dddd2222eeee",
"commerceId": "99e6a635-48e7-424d-9059-c9db944e3c54",
"companyProfile": {
"tenantId": "aaaabbbb-0000-cccc-1111-dddd2222eeee",
"domain": "abcdefgh1234.onmicrosoft.com",
"companyName": "1kl as kjk",
"address": {
"country": "US",
"region": "wa",
"city": "redmond",
"addressLine1": "1 ms way",
"postalCode": "98052",
"phoneNumber": "1234567890"
},
"email": "a@a.com",
"links": {
"self": {
"uri": "/customers/aaaabbbb-0000-cccc-1111-dddd2222eeee/profiles/company",
"method": "GET",
"headers": []
}
},
"attributes": {
"objectType": "CustomerCompanyProfile"
}
},
"billingProfile": {
"id": "eeada110-69d6-4cc9-b093-75feb7ca9d3f",
"firstName": "d0d89d776d03471c819bf772191ed728",
"lastName": "kjkAJJAAAAAAAAAAAAAAAAAAAA",
"email": "a@a.com",
"culture": "en-US",
"language": "en",
"companyName": "1kl as kjkAAAAAAAAAAAAAAAJJJJJJJJJJJAAAAAJJJJJJJJJJJAAJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJAJJJJJAJJAAAAJAJJAAAAAAAAAAAAAAAAAAAA",
"defaultAddress": {
"country": "US",
"city": "redmond",
"state": "WA",
"addressLine1": "1 ms way",
"postalCode": "98052",
"firstName": "1kl as",
"lastName": "kjk",
"phoneNumber": "1234567890"
},
"links": {
"self": {
"uri": "/customers/aaaabbbb-0000-cccc-1111-dddd2222eeee/profiles/billing",
"method": "GET",
"headers": [
]
}
},
"attributes": {
"etag": "-4242348048554929329",
"objectType": "CustomerBillingProfile"
}
},
"relationshipToPartner": "reseller",
"allowDelegatedAccess": true,
"customDomains": [
"abcdefgh1234.onmicrosoft.com"
],
tags": [
"TestCustomer",
"USCustomer"
],
"links": {
"self": {
"uri": "/customers/aaaabbbb-0000-cccc-1111-dddd2222eeee",
"method": "GET",
"headers": []
}
},
"attributes": {
"objectType": "Customer"
}
}