List
Get batched usage data
client.v1.usage.list(UsageListParamsparams, RequestOptionsoptions?): dataarraynext_pageunionUsageListResponse
post/v1/usage
Fetch aggregated usage data for multiple customers and billable-metrics, broken into intervals of the specified length.
Parameters
paramsending_beforestringstarting_onstringwindow_sizeunionnext_pagestringbillable_metricsarraycustomer_idsarrayUsageListParams
Returns
UsageListResponse
import Metronome from '@metronome/sdk';
const client = new Metronome({
bearerToken: 'My Bearer Token',
});
const usages = await client.v1.usage.list({
ending_before: '2021-01-03T00:00:00Z',
starting_on: '2021-01-01T00:00:00Z',
window_size: 'day',
});
console.log(usages.data);
200 Example
{
"data": [
{
"billable_metric_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"billable_metric_name": "billable_metric_name",
"customer_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"end_timestamp": "2019-12-27T18:11:19.117Z",
"start_timestamp": "2019-12-27T18:11:19.117Z",
"value": 0,
"groups": {
"foo": 0
}
}
],
"next_page": "next_page"
}