Get billing statement excel file¶
Get billing statement excel file that describes the monthly billing.
Prerequisites¶
Credentials as described in Authentication
An billings statement id as described in Get billing statements
C#¶
var client = new CrayonApiClient("https://api.crayon.com/");
var token = client.Tokens.GetUserToken(clientId, clientSecret, userName, password).GetData().AccessToken;
var result = client.BillingStatements.GetAsFile(token, billingStatementId);
Request¶
Request Syntax:
Method |
Request URI |
---|---|
GET |
https://api.crayon.com/api/v1/billingstatements/file/{id}/ |
Request Parameters:
Name |
Type |
Description |
Required |
---|---|---|---|
id |
int |
The billing statement id |
YES |
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 response type, “application/json” or “application/octet-stream” |
Request Example:
GET $"https://api.crayon.com/api/v1/billingstatements/file/{id}/"
Accept : application/json
Authorization : Bearer < Token >
Response¶
If successful, this method returns a BillingStatementFile object of BillingStatementFile resource in the response body. The data property contains byte array with the excel file. If excel file is split into more then one file. Then a zip file is returned with multiple files.
{
"BillingStatement": {
"GroupId": 123456,
"Id": 098765,
"TotalSalesPrice": {
"Value": 1000.00,
"CurrencyCode": "EUR"
},
"InvoiceProfile": {
"Id": 1,
"Name": "My invoice profile Name"
},
"Organization": {
"Id": 1,
"Name": "My organization Name"
},
"StartDate": "2009-12-22T19:21:04+00:00",
"EndDate": "2018-12-22T19:21:04+00:00",
"ProvisionType": 1,
"OrderId": "1234567890"
},
"FileName": "customer-billings-statement.xlsx",
"Data": "IJQRJwzoQUcB2ZpLajtrTdiJqTAbIiHPCJnQgoYA7O0FIQt7XK8bcRMKEG1K75eFICZUALGwCytBGFf28FMCEG1NW6YCSHgODBLC0FtX71Jzqq98DWLTpuxrsD6AhtazA62YX+5ec6qbWzDjIZ3MBOLAsbALL0oCJvFDmZCBap96nprMoaciTWBwaKcrVWgUWsKEeAdZuRMiABjyFlaBMLuryNnQgN4AxnMhAYwBmZpDQibuw5mYkHA+8NgJjSAMTBLa0DYu3UwExrA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mZpDaiZhZswE17hTHiFBdYX2NBitp/VvMKNmAkNEFbhTFiFBQZm6XVAsOo2vzfZ7dvJhFNYYMiZ2AtKO4WzmlO4Uc7EOkAYhctio10qYRS2cVFr+vaC2OuLnNF43xUYckZxaM30OsDnE86ET1hgYCbWAcInbOOinPnOA9jri5wJDWAMORMakPYJZz6fcBke7TkKn7CIAzNxHpD2CWc+n3AZHjPjM2ERB2biPCDtE858PuEyPGZGuoB+JvaChE/Yxtl+5vMJZ8InLLCuwPoCG1osYuY7ExY+4YwxMBPrAOETtnERM986gL2+eGMBje1gJtYBwids4yJmvnUAe33BTKwDhE9YxKE103tBPp9wxl5fMBMaIHzCIg7M0hrg8wln7PUFM7EOED5hEQdm6XWAzyecsdcXzIQGCJ+wiAOz9F6QzyeMN5XTt7wEhjtA7AUJn7CNi+4A35kwe32RM6EBwics4pCz9DrA5xPO2OsLZkIDhE9YxIFZeh3g8wlnwicssK7A+gIbWsy2ps8nnAmfsMDATGiA8AnbuIiZTw"
}
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. |