const fetch = require('node-fetch');

let url = 'https://api.coralogix.com/mgmt/openapi/v2/datausage/daily/units';

let options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <API_KEY>', 'content-type': 'application/json'},
  body: '{"range":"RANGE_UNSPECIFIED","dateRange":{"fromDate":"2021-01-01T00:00:00.000Z","toDate":"2021-01-01T00:00:00.000Z"}}'
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error('error:' + err));
{
  "units": [
    {
      "statsDate": "2023-11-07T05:31:56Z",
      "totalUnits": {
        "value": 123
      },
      "blockedUnits": {
        "value": 123
      },
      "lowLogsUnits": {
        "value": 123
      },
      "mediumLogsUnits": {
        "value": 123
      },
      "highLogsUnits": {
        "value": 123
      },
      "highMetricsUnits": {
        "value": 123
      },
      "lowTracingUnits": {
        "value": 123
      },
      "mediumTracingUnits": {
        "value": 123
      },
      "highTracingUnits": {
        "value": 123
      },
      "lowSessionRecordingUnits": {
        "value": 123
      },
      "evaluationUnits": {
        "value": 123
      },
      "cpuProfilesUnits": {
        "value": 123
      },
      "blockedMetricsUnits": {
        "value": 123
      }
    }
  ]
}

Authorizations

Authorization
string
header
required

API key authentication

Body

application/json

Response

200
application/json

A successful response.

The response is of type object.