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": {
"name": "Example Slo Name",
"targetThresholdPercentage": 99.999,
"id": "b11919d5-ef85-4bb1-8655-02640dbe94d9",
"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",
"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
}
}
}No description available
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": {
"name": "Example Slo Name",
"targetThresholdPercentage": 99.999,
"id": "b11919d5-ef85-4bb1-8655-02640dbe94d9",
"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",
"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
}
}
}API key authentication
Definition of an SLO
"Example Slo Name"
99.999
"b11919d5-ef85-4bb1-8655-02640dbe94d9"
"A brief description of my SLO"
"test@domain.com"
Show child attributes
The revision of the slo, used to differentiate between different versions of the same SLO
Show child attributes
Definition of the SLO grouping fields
Show child attributes
SLO_TIME_FRAME_UNSPECIFIED, SLO_TIME_FRAME_7_DAYS, SLO_TIME_FRAME_14_DAYS, SLO_TIME_FRAME_21_DAYS, SLO_TIME_FRAME_28_DAYS Definition of a request-based SLI based on metrics
Show child attributes
Definition of a window-based SLI based on metrics
Show child attributes
A successful response.
Response after creating a new SLO.
Definition of an SLO
Show child attributes
Was this page helpful?