Skip to main content
node
const fetch = require('node-fetch');

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

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

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

Authorizations

Authorization
string
header
required

API key authentication

Body

application/json
  • Slo
  • Slo

Definition of an SLO

name
string
required
Example:

"Example Slo Name"

targetThresholdPercentage
number
required
Example:

99.999

createTime
string<date-time>
creator
string
Example:

"test@domain.com"

description
string
Example:

"A brief description of my SLO"

grouping
object

Definition of the SLO grouping fields

id
string
Example:

"b11919d5-ef85-4bb1-8655-02640dbe94d9"

labels
object[]
requestBasedMetricSli
object

Definition of a request-based SLI based on metrics

revision
object

The revision of the slo, used to differentiate between different versions of the same SLO

sloTimeFrame
enum<string>
Available options:
SLO_TIME_FRAME_UNSPECIFIED,
SLO_TIME_FRAME_7_DAYS,
SLO_TIME_FRAME_14_DAYS,
SLO_TIME_FRAME_21_DAYS,
SLO_TIME_FRAME_28_DAYS
type
string
Example:

"request"

updateTime
string<date-time>

Response

Response after replacing an existing SLO.

slo
object
required

Definition of an SLO

  • Slo
  • Slo
effectedSloAlertIds
string[]
I