Ingest
Ingest events
client.v1.usage.ingest(UsageIngestParamsbody?, RequestOptionsoptions?): void
post/v1/ingest
Send usage events to Metronome. The body of this request is expected to be a JSON array of between 1 and 100 usage events. Compressed request bodies are supported with a Content-Encoding: gzip header. See Getting usage into Metronome to learn more about usage events.
Parameters
bodyusagearrayUsageIngestParams
import Metronome from '@metronome/sdk';
const client = new Metronome({
bearerToken: 'My Bearer Token',
});
await client.v1.usage.ingest([
{
customer_id: '[email protected]',
event_type: 'heartbeat',
timestamp: '2021-01-01T00:00:00Z',
transaction_id: '2021-01-01T00:00:00Z_cluster42',
},
]);