Table of Contents
API : Finance Report Get
Introduction
This request will return a finance report for a specific customer, in a specific time period. The purpose of this endpoint is for resellers to get a better overview on costs and revenue on a specific customer.
This endpoint is different from just getting the customer's invoice for that month, in that it gives all the lines regarding the specific period. E.g an invoice made on July 1st will cover usage from June, but subscriptions/products from July and onwards, because subscriptions are billed ahead.
This endpoint also supports “accrual accounting” of invoice lines. As an example, a line can have the period 01-07-2024 - 31-09-2024, which would amount to a unit price times three months. If a finance report is fetched for the period 01-07-2024 - 31-07-2024, then that line will only have one unit, because the line has been “split”.
In short, this finance report allows viewing the usage and subscriptions that only covers the specific period.
Request
| URL | https://api.telecomx.dk/financeReport/CUSTOMER_ID | |
|---|---|---|
| Method | GET | |
| Access level | RESELLER if customer belongs to the reseller. RESELLER_ADMIN ADMIN. |
|
| Param | CUSTOMER_ID | Id of the customer (24 hex-char string) |
| Query | from | From date in YYYY-MM format, always defaults to the first day of the month. |
| to | [optional] To date in YYYY-MM format. If not set, it will be set to a month after the “from” date |
|
| format | [optional] Format to get the data in. Allowed values are CSV and JSON. Defaults to JSON. |
|
Query example
https://api.telecomx.dk/financeReport/1234567890ABCDEF12345678?from=2024-06 https://api.telecomx.dk/financeReport/1234567890ABCDEF12345678?from=2024-06&to=2024-07 https://api.telecomx.dk/financeReport/1234567890ABCDEF12345678?from=2024-06&to=2024-08
Response
| JSON object | ||
|---|---|---|
| customer | Id | Id of customer report is for. |
| lines | Array | Array of invoice lines - see below: |
| lines[item].product | ObjectID | Id of product used. |
| lines[item].productCode | String | Product code, e.g. 'IN4010'. |
| lines[item].name | String | Product name, e.g. 'Internet VDSL 40/10Mbit'. |
| lines[item].description | String | Optional descriptive text, e.g. 'for perioden 1/1 - 31/1-2014'. |
| lines[item].units | Number | Number of units (to be multiplied by the unit price). |
| lines[item].type | String | Type of units: MIN, MB, UNITS, HOURS, KM, MONTHS. |
| lines[item].unitCost | Number | Cost pr. unit (ADMIN only). |
| lines[item].unitWholesale | Number | Reseller price pr. unit (RESELLER/ADMIN only). |
| lines[item].unitPrice | Number | Sales prices pr. unit |
| lines[item].vatExempt | Boolean | True if this is exempt from VAT |
| lines[item].from | Date | From date for this line. |
| lines[item].to | Date | To date for this line. |
| subTotalCost | Number | Total cost before tax (ADMIN only). |
| subTotalWholesale | Number | Total wholesale cost before tax (RESELLER/ADMIN only). |
| subTotal | Number | Total price before tax. |
| vat | Double | Value added tax. |
| vatCost | Double | Value added tax on cost (ADMIN only). |
| vatWholesale | Double | Value added tax on wholesale (RESELLER/ADMIN only). |
| total | Double | Sales price including VAT. |
Note that properties holding no value may be omitted from the object.
Example (JSON)
{ "customer": "54463ed73fc6ea53780080cf", "lines": [ { "product": "548ecd936b34cd1826f3ff2b", "productCode": "NUM01", "name": "Nummerleje", "description": "1 numre - Periode: 01-11-2014 - 31-03-2015", "units": 5, "type": "MONTHS", "unitWholesale": 20, "unitPrice": 25, "vatExempt": false, }, { "product": "54917e9940c67b6c3dd05a8c", "productCode": "FORBRUG1", "name": "Samtaler", "description": "SIP konto: Hovedkonto - kald: 544 - tid: 25:34:05 - periode: 01-12-2014 - 31-12-2014", "units": 1, "type": "UNITS", "unitWholesale": 398.18, "unitPrice": 792.22, "vatExempt": false, }, { "product": "54917e9940c67b6c3dd05a8c", "productCode": "FORBRUG1", "name": "Samtaler", "description": "SIP konto: Fax - kald: 15 - tid: 00:11:47 - periode: 01-12-2014 - 31-12-2014", "units": 1, "type": "UNITS", "unitWholesale": 1.63, "unitPrice": 3.54, "vatExempt": false, } ], "subTotalWholesale": 499.81, "subTotal": 920.76, "vatWholesale": 124.95, "vat": 230.19, "total": 1150.95 }
Example (CSV) lang=da
"Varenummer";"Produktnavn";"BeskrivelseUdenPeriode";"From";"To";"Antal";"Forhandlerpris";"Pris" "Nummerleje";"1 numre";"2014-11-01";"2014-11-30";5;"MONTHS";20;25 ...
Example (CSV) lang=en
"ProductCode";"ProduktName";"DescriptionWithoutPeriod";"From";"To";"Amount";"ResellerPrice";"Price" "Nummerleje";"1 numre";"2014-11-01";"2014-11-30";5;"MONTHS";20;25 ...
Errors
| Error code | Message | Description |
|---|---|---|
| 404 | customer | Customer not found |
| 404 | from | From date not found |
| 422 | from | Date is not valid |
| 422 | to | Date is not valid |
| 422 | to | Date cannot be before from |
| 422 | to | Date cannot be later than 2 years from the from-date |
| 403 | access_denied | Insufficient access level |
| 500 | internal_error | <Unspecified> |