const url = '/api/v2/charts/series';
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
body: JSON.stringify({
startTime: 1647014400000,
endTime: 1647100800000,
granularity: '1h',
series: [
{
sourceId: '65f5e4a3b9e77c001a123456',
aggFn: 'count',
where: 'SeverityText:error',
groupBy: []
}
]
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));