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

let url = 'https://api.coralogix.com/mgmt/openapi/v1/incidents:get-filter-values';

let options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <API_KEY>', 'content-type': 'application/json'},
  body: '{"filter":{"assignee":["string"],"status":["INCIDENT_STATUS_UNSPECIFIED"],"state":["INCIDENT_STATE_UNSPECIFIED"],"severity":["INCIDENT_SEVERITY_UNSPECIFIED"],"contextualLabels":{"property1":{"contextualLabelValues":["string"]},"property2":{"contextualLabelValues":["string"]}},"startTime":"2019-08-24T14:15:22Z","endTime":"2019-08-24T14:15:22Z","searchQuery":{"query":"error","incidentField":"INCIDENTS_FIELDS_UNSPECIFIED","contextualLabel":"string"},"applicationName":["string"],"subsystemName":["string"],"isMuted":true,"createdAtRange":{"startTime":"2019-08-24T14:15:22Z","endTime":"2019-08-24T14:15:22Z"},"incidentDurationRange":{"startTime":"2019-08-24T14:15:22Z","endTime":"2019-08-24T14:15:22Z"},"metaLabels":[{"key":"key","value":"value"}],"metaLabelsOp":"FILTER_OPERATOR_OR_OR_UNSPECIFIED"}}'
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error('error:' + err));
{
  "filtersValues": {
    "assigneeWithCount": [
      {
        "assignee": "assignee",
        "count": 10
      }
    ],
    "statusWithCount": [
      {
        "status": "INCIDENT_STATUS_UNSPECIFIED",
        "count": 10
      }
    ],
    "stateWithCount": [
      {
        "state": "INCIDENT_STATE_UNSPECIFIED",
        "count": 10
      }
    ],
    "severityWithCount": [
      {
        "severity": "INCIDENT_SEVERITY_UNSPECIFIED",
        "count": 10
      }
    ],
    "contextualLabels": {},
    "metaLabelsWithCount": [
      {
        "metaLabel": {
          "key": "key",
          "value": "value"
        },
        "count": 10
      }
    ],
    "metaLabelsOp": "FILTER_OPERATOR_OR_OR_UNSPECIFIED"
  }
}

Authorizations

Authorization
string
header
required

API key authentication

Body

application/json

Request to get available filter values for incidents

Response

200
application/json

A successful response.

Response containing available filter values for incidents