Get grouped billing statements¶
Returns billing cycles
Prerequisites¶
Credentials as described in Authentication
C#¶
To get grouped billing statements, first create the instance of CrayonApiClient and get token using the instance.
Then call BillingStatements.GetGrouped() method to get grouped billing statements by passing token.
var filter = new BillingStatementFilter {
OrganizationId = <Organization Id>,
InvoiceProfileId = <Invoice Profile Id>,
ProvisionType = <None / Seat / Usage / OneTime / Crayon / AzureMarketplace>,
From = <from date>,
To = <to date>,
Page = <page number>,
PageSize = <page size>
};
var client = new CrayonApiClient("https://api.crayon.com/");
var token = client.Tokens.GetUserToken(clientId, clientSecret, userName, password).GetData().AccessToken;
var result = client.BillingStatements.GetGrouped(token, filter);
Request¶
Request Syntax:
Method |
Request URI |
---|---|
GET |
https://api.crayon.com/api/v1/billingstatements/grouped?invoiceProfileId=16948&organizationId=4027110 |
Request Parameters:
Name |
Type |
Required |
---|---|---|
invoiceProfileId |
int |
No |
organizationId |
int |
Yes |
provisionType |
Enum |
No |
from |
DateTimeOffset? |
No |
to |
DateTimeOffset? |
No |
page |
int |
No |
pageSize |
int |
No |
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/billingstatements/grouped?invoiceProfileId=16948&organizationId=4027110"
Accept : application/json
Content-Type: application/json
Authorization : Bearer < Token >
Response¶
If successful, this method returns a collection of billing statements grouped by currency and provision type in the response body.
{
"Items": [
{
"GroupId": 12345,
"Id": 67890,
"TotalSalesPrice": {
"Value": 1500.00,
"CurrencyCode": "USD"
},
"InvoiceProfile": {
"Id": 11111,
"Name": "Test Profile 1"
},
"Organization": {
"Id": 22222,
"Name": "Fake Corp"
},
"StartDate": "2023-01-01T00:00:00+00:00",
"EndDate": "2023-02-01T00:00:00+00:00",
"ProvisionType": 1,
"OrderId": "1234567890"
},
{
"GroupId": 54321,
"Id": 98765,
"TotalSalesPrice": {
"Value": 2500.00,
"CurrencyCode": "USD"
},
"InvoiceProfile": {
"Id": 22222,
"Name": "Test Profile 2"
},
"Organization": {
"Id": 33333,
"Name": "Demo Inc."
},
"StartDate": "2023-02-01T00:00:00+00:00",
"EndDate": "2023-03-01T00:00:00+00:00",
"ProvisionType": 2,
"OrderId": "0987654321"
},
{
"GroupId": 67890,
"Id": 12345,
"TotalSalesPrice": {
"Value": 3500.00,
"CurrencyCode": "USD"
},
"InvoiceProfile": {
"Id": 33333,
"Name": "Test Profile 3"
},
"Organization": {
"Id": 44444,
"Name": "Sample LLC"
},
"StartDate": "2023-03-01T00:00:00+00:00",
"EndDate": "2023-04-01T00:00:00+00:00",
"ProvisionType": 3,
"OrderId": "1122334455"
}
],
"TotalHits": 3
}
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. |
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. |