Get all of a customer's orders
Applies to: Partner Center | Partner Center operated by 21Vianet | Partner Center for Microsoft Cloud for US Government
Gets a collection of all the orders for a specified customer. There's a delay of up to 15 minutes between the time an order is submitted and when it appears in a collection of a customer's orders.
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 obtain a collection of all of a customer's orders:
Use your IAggregatePartner.Customers collection and call the ById() method.
Call the Orders property, followed by the Get() or GetAsync() methods.
// IAggregatePartner partnerOperations;
// string selectedCustomerId;
var orders = partnerOperations.Customers.ById(selectedCustomerId).Orders.Get();
Sample: Console test app. Project: PartnerSDK.FeatureSamples Class: GetOrders.cs
REST request
Request syntax
Method | Request URI |
---|---|
GET | {baseURL}/v1/customers/{customer-tenant-id}/orders HTTP/1.1 |
URI parameter
Use the following query parameter to get all orders.
Name | Type | Required | Description |
---|---|---|---|
customer-tenant-id | string | Yes | A GUID formatted string corresponding to 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/b0d70a69-4c42-4b27-b17b-91a835d8686a/orders HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 0e5fc923-8e3c-4560-9100-ce7283c3e081
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
Connection: Keep-Alive
REST response
If successful, this method returns a collection of Order resources in the response body.
Response success and error codes
Each response comes with an HTTP status code that indicates success or failure and other debugging information. Use a network trace tool to read this code, error type, and other parameters. For the full list, see Error Codes.
Response example
HTTP/1.1 200 OK
Content-Length: 22463
Content-Type: application/json; charset=utf-8
MS-RequestId: 0e5fc923-8e3c-4560-9100-ce7283c3e081
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
Date: Thu, 15 Mar 2018 20:44:40 GMT
{
"totalCount": 2,
"items": [
{
"id": "9qg-ErcO-4MPbPqq_3MIQaS7bn8W6HfG1",
"referenceCustomerId": "b0d70a69-4c42-4b27-b17b-91a835d8686a",
"billingCycle": "one_time",
"currencyCode": "USD",
"lineItems": [
{
"lineItemNumber": 0,
"offerId": "DZH318Z0BQ4B:000Z:DZH318Z0DSPL",
"friendlyName": "Reserved_VM_Instance_Standard_D1_AP_East_1_Year",
"quantity": 1,
"links": {
"sku": {
"uri": "/products/DZH318Z0BQ4B/skus/000Z?country=US",
"method": "GET",
"headers": []
}
}
}
],
"creationDate": "2018-03-15T02:17:15.6455674Z",
"status": "pending",
"links": {
"provisioningStatus": {
"uri": "/customers/b0d70a69-4c42-4b27-b17b-91a835d8686a/orders/9qg-ErcO-4MPbPqq_3MIQaS7bn8W6HfG1/provisioningstatus",
"method": "GET",
"headers": []
},
"self": {
"uri": "/customers/b0d70a69-4c42-4b27-b17b-91a835d8686a/orders/9qg-ErcO-4MPbPqq_3MIQaS7bn8W6HfG1",
"method": "GET",
"headers": []
}
},
"attributes": {
"objectType": "Order"
}
},
{
"id": "eeba9d00-7b46-443a-917e-22887a8fc993",
"referenceCustomerId": "b0d70a69-4c42-4b27-b17b-91a835d8686a",
"billingCycle": "monthly",
"currencyCode": "USD",
"lineItems": [
{
"lineItemNumber": 0,
"offerId": "E59159FC-6F67-4599-B3CB-17FF4020F643",
"subscriptionId": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
"friendlyName": "Azure Active Directory Premium P2",
"quantity": 1,
"links": {
"subscription": {
"uri": "/customers/b0d70a69-4c42-4b27-b17b-91a835d8686a/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
"method": "GET",
"headers": []
},
"sku": {
"uri": "/products/84A661C4-E949-4BD2-A560-ED7766FCAF2B/skus/E59159FC-6F67-4599-B3CB-17FF4020F643",
"method": "GET",
"headers": []
},
"provisioningStatus": {
"uri": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/provisioningstatus",
"method": "GET",
"headers": []
}
}
],
"creationDate": "2018-03-06T17:37:05.253-08:00",
"status": "completed",
"links": {
"self": {
"uri": "/customers/b0d70a69-4c42-4b27-b17b-91a835d8686a/orders/eeba9d00-7b46-443a-917e-22887a8fc993",
"method": "GET",
"headers": []
}
},
"attributes": {
"etag": "eyJpZCI6ImVlYmE5ZDAwLTdiNDYtNDQzYS05MTdlLTIyODg3YThmYzk5MyIsInZlcnNpb24iOjF9",
"objectType": "Order"
}
}
],
"links": {
"self": {
"uri": "/customers/b0d70a69-4c42-4b27-b17b-91a835d8686a/orders",
"method": "GET",
"headers": []
}
},
"attributes": {
"objectType": "Collection"
}
}