POST
/
v1
/
slo
/
slos
const fetch = require('node-fetch');

let url = 'https://api.coralogix.com/mgmt/openapi/v1/slo/slos';

let options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <API_KEY>', 'content-type': 'application/json'},
  body: '{"id":"b11919d5-ef85-4bb1-8655-02640dbe94d9","name":"Example Slo Name","description":"A brief description of my SLO","creator":"test@domain.com","labels":{"property1":"string","property2":"string"},"revision":{"revision":1,"updateTime":"2019-08-24T14:15:22Z"},"grouping":{"labels":["string"]},"createTime":"2019-08-24T14:15:22Z","updateTime":"2019-08-24T14:15:22Z","targetThresholdPercentage":99.999,"sloTimeFrame":"SLO_TIME_FRAME_UNSPECIFIED","requestBasedMetricSli":{"goodEvents":{"query":"sum(rate(http_requests_total{status=\"200\"}[5m]))"},"totalEvents":{"query":"sum(rate(http_requests_total{status=\"200\"}[5m]))"}},"windowBasedMetricSli":{"query":{"query":"sum(rate(http_requests_total{status=\"200\"}[5m]))"},"window":"WINDOW_SLO_WINDOW_UNSPECIFIED","comparisonOperator":"COMPARISON_OPERATOR_UNSPECIFIED","threshold":0.95}}'
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error('error:' + err));
{
  "slo": {
    "id": "b11919d5-ef85-4bb1-8655-02640dbe94d9",
    "name": "Example Slo Name",
    "description": "A brief description of my SLO",
    "creator": "test@domain.com",
    "labels": {},
    "revision": {
      "revision": 1,
      "updateTime": "2023-11-07T05:31:56Z"
    },
    "grouping": {
      "labels": [
        "<string>"
      ]
    },
    "createTime": "2023-11-07T05:31:56Z",
    "updateTime": "2023-11-07T05:31:56Z",
    "targetThresholdPercentage": 99.999,
    "sloTimeFrame": "SLO_TIME_FRAME_UNSPECIFIED",
    "requestBasedMetricSli": {
      "goodEvents": {
        "query": "sum(rate(http_requests_total{status=\"200\"}[5m]))"
      },
      "totalEvents": {
        "query": "sum(rate(http_requests_total{status=\"200\"}[5m]))"
      }
    },
    "windowBasedMetricSli": {
      "query": {
        "query": "sum(rate(http_requests_total{status=\"200\"}[5m]))"
      },
      "window": "WINDOW_SLO_WINDOW_UNSPECIFIED",
      "comparisonOperator": "COMPARISON_OPERATOR_UNSPECIFIED",
      "threshold": 0.95
    }
  }
}

Authorizations

Authorization
string
header
required

API key authentication

Body

application/json

Definition of an SLO

Response

200
application/json

A successful response.

Response after creating a new SLO.