Get Processed Purchase Orders¶
Retrieves processed purchase orders for a given customer tenant, with support for filtering, pagination, and sorting.
Prerequisites¶
Credentials as described in Authentication
Request¶
Request Syntax:
Method |
Request URI |
---|---|
GET |
https://api.crayon.com/api/v1/purchaserequest/orders/ |
Request Parameters:
Name |
Type |
Description |
---|---|---|
customerTenantId |
integer |
Required. Unique ID of the customer tenant whose orders should be retrieved. |
orderState |
enum |
Filters orders by their current state (e.g., None = 0, Successful = 1, Failed = 2, Processing = 4). |
search |
string |
Free-text search term to match against order details. |
page |
integer |
Page number |
pageSize |
integer |
Page size |
sortOrder |
enum |
Sort direction: Ascending or Descending |
sortBy |
enum |
Field to sort by (e.g., CreationDate, ScheduledDate) |
Request Headers:
The following HTTP request headers are supported
Header |
Type |
Description |
|
---|---|---|---|
Authorization |
string |
Required. The authorization token in the form Bearer <token>. |
|
Accept |
string |
Specifies the request and response type, “application/json”. |
|
Content-Type |
string |
Specifies the media type of the resource, “application/json”. |
Request Example:
GET $"https://api.crayon.com/api/v1/purchaserequest/orders?search=&customerTenantId=1234&page=1&pageSize=15&sortBy=&sortOrder=Ascending&orderState=0"
Accept : application/json
Content-Type: application/json
Authorization : Bearer < Token >
Response¶
If successful, this method returns collection of purchase Orders for provided cloud account (customer tenant) in the response body.
{
"Items": [
{
"OrderReferenceId": 1414,
"CatalogId": "string",
"Name": "Windows 11 Home to Pro Upgrade for Microsoft 365 Business",
"Quantity": 1,
"BillingCycle": "OneTime",
"TermDuration": "string",
"EmailReceiver": "string",
"Created": "2025-08-04T09:17:18.193",
"OrderState": "Succeeded",
"Error": null
},
{
"OrderReferenceId": 1412,
"CatalogId": "string",
"Name": "AI Builder Capacity Add-on T1 - P1M - Monthly",
"Quantity": 1,
"BillingCycle": "Monthly",
"TermDuration": "string",
"EmailReceiver": "string",
"Created": "2025-04-15T15:43:05.5",
"OrderState": "Failed",
"Error": null
}
],
"TotalHits": 2
}
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.
Error Codes |
Description |
---|---|
200 Ok |
The request has succeeded. |
400 Bad Request |
The request could not be understood by the server due to malformed syntax, missing required properties, properties that couldn’t be parsed according to their type (and length). It is a non-retryable error condition. The client should not repeat the request without modifications. |
401 Unauthorized |
The request requires user authentication. If the request already included Authorization credentials, then the 401 (Unauthorized) status code means that authorization has been refused for those credentials. It is a non-retryable error condition. |