API-Referenz für Metriken

Alle Metriken abrufen

Endpunkt:

GET /v1/:page_id/metrics?page=:page&per_page=:per_page
  • Die Standard-Seitennummer ist 1.
  • Der Standardwert für per_page ist 50, das Maximum sind 100 Einträge pro Seite.

Beispielantwort:

[
{
"id": "ckj1qyonq9sdk09819xdg4ehm",
"name": "Testing",
"active": true,
"order": 1,
"suffix": "ms",
"data": [
{
"timestamp": 1608474985000,
"value": 355
},
{
"timestamp": 1608475225000,
"value": 428.25
},
{
"timestamp": 1608475465000,
"value": 356
},
{
"timestamp": 1608475705000,
"value": 451.75
},
...
]
},
...
]

Eine Metrik abrufen

Endpunkt:

GET /v1/:page_id/metrics/:metric_id

Beispielantwort:

{
"id": "ckj1qyonq9sdk09819xdg4ehm",
"name": "Testing",
"active": true,
"order": 1,
"suffix": "ms",
"data": [
{
"timestamp": 1608474985000,
"value": 355
},
{
"timestamp": 1608475225000,
"value": 428.25
},
{
"timestamp": 1608475465000,
"value": 356
},
{
"timestamp": 1608475705000,
"value": 451.75
},
...
]
}

Eine Metrik hinzufügen

Endpunkt:

POST /v1/:page_id/metrics
{
"subdomain": "nasa",
"name": "Response time",
"suffix": "ms"
}

Beispielantwort:

{
"id": "ckj1qyonq9sdk09819xdg4ehm",
"name": "Response time",
"active": true,
"order": 1,
"suffix": "ms",
"lastDataAt": 1608561235000,
"data": [
{
"timestamp": 1608474985000,
"value": 355
},
{
"timestamp": 1608475225000,
"value": 428.25
},
{
"timestamp": 1608475465000,
"value": 356
},
...
]
}

Eine Metrik aktualisieren

Endpunkt:

PUT /v1/:page_id/metrics/:metric_id

Beispielanfrage:

{
"name": "Response time",
"suffix": "ms"
}

Beispielantwort:

{
"id": "ckj1qyonq9sdk09819xdg4ehm",
"name": "Response time",
"active": true,
"order": 1,
"suffix": "ms",
"lastDataAt": 1608561235000,
"data": [
{
"timestamp": 1608474985000,
"value": 355
},
{
"timestamp": 1608475225000,
"value": 428.25
},
{
"timestamp": 1608475465000,
"value": 356
},
...
]
}

Eine Metrik löschen

Endpunkt:

DELETE /v1/:page_id/metrics/:metric_id

Einen Datenpunkt zu einer Metrik hinzufügen

Endpunkt:

POST /v1/:page_id/metrics/:metric_id

Anfrage:

{
"timestamp": 1608672985000,
"value": 356
}

Antwort:

{
"id": "ckj395ptx9ha40995ckzv0pz2",
"value": 356,
"timestamp": 1608672985000
}

Mehrere Datenpunkte zu einer Metrik hinzufügen

Endpunkt:

POST /v1/:page_id/metrics/:metric_id/data

Anfrage:

{
"data": [
{
"timestamp": 1608474985000,
"value": 355
},
{
"timestamp": 1608475225000,
"value": 428.25
},
{
"timestamp": 1608475465000,
"value": 356
},
{
"timestamp": 1608475705000,
"value": 451.75
},
{
"timestamp": 1608475945000,
"value": 395
},
{
"timestamp": 1608476185000,
"value": 375.75
},
{
"timestamp": 1608476425000,
"value": 380.25
},
...
]
}

Antwort

[
{
"timestamp": 1608474985000,
"value": 355
},
{
"timestamp": 1608475225000,
"value": 428.25
},
{
"timestamp": 1608475465000,
"value": 356
},
{
"timestamp": 1608475705000,
"value": 451.75
},
{
"timestamp": 1608475945000,
"value": 395
},
{
"timestamp": 1608476185000,
"value": 375.75
},
{
"timestamp": 1608476425000,
"value": 380.25
}
]

Datenpunkte einer Metrik löschen

Endpunkt:

DELETE /v1/:page_id/metrics/:metric_id/data

Antwort

{
"name": "Response time",
"site": {
"id": "ckj1qyonq9sdk09819xdg4ehm",
"subdomain": "our"
}
}