Metrikler API Referansı

Tüm metrikleri getirin

Uç nokta:

GET /v1/:page_id/metrics?page=:page&per_page=:per_page
  • Varsayılan sayfa numarası 1'dir.
  • Varsayılan per_page değeri 50'dir; sayfa başına en fazla 100 öğedir.

Örnek yanıt:

[
{
"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
},
...
]
},
...
]

Bir metriği getirin

Uç nokta:

GET /v1/:page_id/metrics/:metric_id

Örnek yanıt:

{
"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
},
...
]
}

Metrik ekleyin

Uç nokta:

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

Örnek yanıt:

{
"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
},
...
]
}

Metriği güncelleyin

Uç nokta:

PUT /v1/:page_id/metrics/:metric_id

Örnek istek:

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

Örnek yanıt:

{
"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
},
...
]
}

Metriği silin

Uç nokta:

DELETE /v1/:page_id/metrics/:metric_id

Bir metriğe veri noktası ekleyin

Uç nokta:

POST /v1/:page_id/metrics/:metric_id

İstek:

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

Yanıt:

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

Bir metriğe birden fazla veri noktası ekleyin

Uç nokta:

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

İstek:

{
"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
},
...
]
}

Yanıt

[
{
"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
}
]

Bir metriğin veri noktalarını silin

Uç nokta:

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

Yanıt

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