Get a list of orders by customer and billing cycle type
Applies to: Partner Center | Partner Center operated by 21Vianet | Partner Center for Microsoft Cloud for US Government
Gets a collection of Order resources that correspond to a given customer and billing cycle type. 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 get a collection of a customer's orders:
Use your IAggregatePartner.Customers collection and call the ById() method with the selected customer ID.
Call the Orders property and the ByBillingCycleType() method with your specified BillingCycleType.
Call the Get() or GetAsync() method.
// IAggregatePartner partnerOperations;
// string selectedCustomerId;
// BillingCycleType selectedBillingCycleType;
var orders = partnerOperations.Customers.ById(selectedCustomerId).Orders.ByBillingCycleType(selectedBillingCycleType).Get();
REST request
Request syntax
Method | Request URI |
---|---|
GET | {baseURL}/v1/customers/{customer-tenant-id}/orders?billingType={billing-cycle-type} HTTP/1.1 |
URI parameters
This table lists the required query parameters to get a collection of orders by customer ID and billing cycle type.
Name | Type | Required | Description |
---|---|---|---|
customer-tenant-id | string | Yes | A GUID formatted string corresponding to the customer. |
billing-cycle-type | string | No | A string corresponding to the billing cycle type. |
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?billingType=onetime 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-CorrelationId: bbbb1111-cc22-3333-44dd-555555eeeeee
MS-RequestId: 3c6a034c-82ee-4095-d50f-9b530a415f1f
MS-CV: nb4/b3Yl2keY0eYR.0
MS-ServerId: 202010607
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": "s-BZlr_TeGksPNT61SsWRL-sqMaKbyVa1",
"referenceCustomerId": "b0d70a69-4c42-4b27-b17b-91a835d8686a",
"billingCycle": "one_time",
"currencyCode": "USD",
"lineItems": [
{
"lineItemNumber": 0,
"offerId": "DZH318Z0BQ4Z:002P:DZH318Z0CL2D",
"friendlyName": "Reserved_VM_Instance_Standard_NC12_AU_East_3_Years",
"quantity": 1,
"links": {
"sku": {
"uri": "/products/DZH318Z0BQ4Z/skus/002P?country=US",
"method": "GET",
"headers": []
}
}
}
],
"creationDate": "2018-03-15T01:42:36.8440279Z",
"status": "pending",
"links": {
"provisioningStatus": {
"uri": "/customers/b0d70a69-4c42-4b27-b17b-91a835d8686a/orders/s-BZlr_TeGksPNT61SsWRL-sqMaKbyVa1/provisioningstatus",
"method": "GET",
"headers": []
},
"self": {
"uri": "/customers/b0d70a69-4c42-4b27-b17b-91a835d8686a/orders/s-BZlr_TeGksPNT61SsWRL-sqMaKbyVa1",
"method": "GET",
"headers": []
}
},
"attributes": { "objectType": "Order" }
}
],
"links": {
"self": {
"uri": "/customers/b0d70a69-4c42-4b27-b17b-91a835d8686a/orders",
"method": "GET",
"headers": []
}
},
"attributes": {
"objectType":
"Collection"
}
}