Get a list of device batches for the specified customer
Applies to: Partner Center
How to retrieve a collection of device batches for the specified customer.
Each device batch contains summary status information about devices that have been enrolled in zero-touch deployment.
Appropriate roles: Admin agent | Sales agent
Prerequisites
Credentials as described in Partner Center authentication. This scenario supports authentication with both standalone App and App+User credentials.
A customer ID (
customer-tenant-id
). If you don't know the customer's ID, you can look it up in Partner Center by selecting the Customers workspace, then the customer from the customer list, then Account. On the customer’s Account page, look for the Microsoft ID in the Customer Account Info section. The Microsoft ID is the same as the customer ID (customer-tenant-id
).
C#
To get the collection of device batches for the specified customer, first call the IAggregatePartner.Customers.ById method with the customer ID to retrieve an interface to operations on the specified customer. Then, retrieve the value of the DeviceBatches property to get an interface to device batch collection operations. Finally, call the Get or GetAsync method to retrieve the collection.
// IAggregatePartner partnerOperations;
// string selectedCustomerId;
var devicesBatches =
partnerOperations.Customers.ById(selectedCustomerId).DeviceBatches.Get();
Sample: Console test app. Project: Partner Center SDK Samples Class: GetDevicesBatches.cs
REST request
Request syntax
Method | Request URI |
---|---|
GET | {baseURL}/v1/customers/{customer-id}/deviceBatches HTTP/1.1 |
URI parameter
Use the following path parameters when creating the request.
Name | Type | Required | Description |
---|---|---|---|
customer-id | string | Yes | A GUID-formatted string that identifies the customer. |
Request headers
For more information, see Partner Center REST headers.
Request body
None
Request example
GET https://api.partnercenter.microsoft.com/v1/customers/47021739-3426-40bf-9601-61b4b6d7c793/deviceBatches HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: e88d014d-ab70-41de-90a0-f7fd1797267d
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
X-Locale: en-US
Host: api.partnercenter.microsoft.com
REST response
If successful, the response body contains the collection of DeviceBatch resources.
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: 339
Content-Type: application/json; charset=utf-8
MS-CorrelationId: bbbb1111-cc22-3333-44dd-555555eeeeee
MS-RequestId: 7b3e2e00-b330-4480-9d84-59ace713427f
MS-CV: YrLe3w6BbUSMt1fi.0
MS-ServerId: 030020344
Date: Tue, 25 Jul 2017 17:52:41 GMT
{
"totalCount": 1,
"items": [{
"id": "Test batch",
"status": "finished",
"creationDate": "2017-07-25T01:51:00",
"devicesCount": 5,
"devicesLink": {
"uri": "/customers/47021739-3426-40bf-9601-61b4b6d7c793/deviceBatches/Test batch/devices",
"method": "GET",
"headers": []
},
"attributes": {
"objectType": "DeviceBatch"
}
}
],
"attributes": {
"objectType": "Collection"
}
}