- 20 Dec 2023
- 4 Minutes to read
- Print
- DarkLight
- PDF
Get invoice line items for all the customers and latest billing period
- Updated on 20 Dec 2023
- 4 Minutes to read
- Print
- DarkLight
- PDF
URL
POST https://contoso-prod-api.azurewebsites.net/api/invoices/Download/v3/BillingPeriods/{billingperiodid}
{{billingperiodid}} – This is an optional parameter. Pass a value to this parameter to get the details for a particular billing period.
Request headers
Key | Value |
Authorization | Bearer <access_token> |
Content-Type | Application/json |
Request body
Payload | Description |
{ "TenantIds":"<tenantids-as-comma-separated-values>" } | The body for this request is optional. If the body is left blank, the API would return the invoice line items for all the active customers. |
Response body
An example response for the request to get active customers is as follows:
{
"OperationType": null,
"Status": "Success",
"RequestCorrelationID": "2f2029ca-54d5-45b8-8e3c-498ff5b6c8f8",
"ErrorMessage": null,
"ErrorDetail": null,
"Data": [
{
"CustomerBillingType": null,
"ERPCustomerID": null,
"CRMOpportunityID": null,
"CouponDiscountPercentage": null,
"ProviderOfferId": null,
"SubscriptionEndDate": null,
"ProviderCategory": null,
"Category": "OneTime",
"ProductSKUId": null,
"TenantID": "d6bc65d1-5678-4eec-1234-5cd9a16ddf66",
"SubscriptionID": "b56a8f1a-1234-a06f-6d4b-057706b11523",
"CurrencyCode": "USD",
"AlternateId": "df5f0cda6324",
"ItemCode": null,
"CustomerName": "Contoso",
"InvoiceNumber": "Invoice_ Contoso_20221218_USD",
"InvoiceGeneratedDate": "2022-12-18T00:00:00",
"InvoiceDueDate": "2023-01-14T00:00:00",
"SubscriptionName": "Twilio SendGrid",
"ChargeStartDate": "2022-11-02T00:00:00",
"ChargeEndDate": "2022-12-01T00:00:00",
"LineItemType": "OneTimeCharges",
"Quantity": 1.00000000,
"UnitPrice": 0.00000000,
"InvoiceLineAmount": 0.00000000,
"DiscountAmount": null,
"TaxAmount": 0.00000000,
"PreTaxAmount": 0.00000000,
"PostTaxAmount": 0.00000000,
"TaxPercentage": 0.00000000,
"SubscriptionType": "OneTime",
"OfferCode": "MS-CSPLicense",
"TaxCode": null,
"OfferID": "DZH318Z09HH9",
"InternalBillingID": "000670",
"CostOnPartner": 0.00000000,
"PONumber": "",
"Notes": null,
"OwnerEntity": "Customer",
"OwnerName": "Contoso"
},
Here is the explanation for the properties in the response (JSON)
Property | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
OperationType | Can be ignored | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Status | Indicates the status of the request. Possible values – Success / Error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
RequestCorrelationID | Internal ID generated by C3 for correspondence for troubleshooting issues, if any. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ErrorMessage | Message in case the request runs into an error during processing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ErrorDetail | Additional detail related to the error in case there is an error while processing the request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Data | Contains a list of billing period objects represented by the following attributes:
|
Error response
The API validates the input parameters – billing period id and the tenant Ids and returns 400 – Bad request error in case the input is found to be invalid.
A sample bad request error covering both the attributes is as follows:
{
"OperationType": null,
"Status": "Error",
"RequestCorrelationID": "3a0ce2d6-e8b6-402f-a926-10f5a7e0f2bb",
"ErrorMessage": "ERROR_DESC_BAD_INPUT",
"ErrorDetail": "ERROR_DESC_BAD_INPUT",
"Data": [
{
"Atribute": "BillingPeriodId",
"AtributeKey": "BILLING_PERIOD_ID",
"Message": "Invalid Billing Period. Should be one of the 9 most recent billing periods",
"DefaultMessage": "INVALID_BILLING_PERIOD_ID",
"Value": "2323
]
}
The following table explains the constituents of the response in detail:
Property | Description |
OperationType | Can be ignored |
Status | Indicates the status of the request. Possible values – Success / Error |
RequestCorrelationID | Internal ID generated by C3 for correspondence for troubleshooting issues, if any. |
ErrorMessage | Message in case the request runs into an error during processing |
ErrorDetail | Additional detail related to the error in case there is an error while processing the request |
Data | Contains a list of validation errors represented by the following attributes:
|