AIOS Métricas - First Detection
GET /first_detection
Retorna a primeira data/hora que ocorreu alguma detecção
Query Params
Name | Type | Desc | Default | Accepted Values |
|---|---|---|---|---|
|
| ID of the pipeline to which the metric belongs | -- | Any |
|
| Type of component in the pipeline to which the metric belongs | -- |
|
|
| ID of the component in the pipeline to which the metric belongs | -- | Any |
|
| Minimal timestamp in window-time |
| Any non-negative integer |
|
| Maximum timestamp in window-time |
| Any non-negative integer |
|
| Window time filter mode |
|
|
|
| List of classes to filter |
| Any |
Body
Nenhum body requerido.
Resposta
Response:
200 OK
{
"result": "2025-02-28T14:26:01+00:00",
"metric_type": "literal"
}Exceptions:
500 Internal Server Error
Exemplos
Python:
import requests
url = "https://metrics.dt-app.com/first_detection"
params = {
"pipeline_id": "00000000-0000-0000-0000-000000000000",
"component_name": "DetectionInPolygon",
# Available values : PolylineWithDirection, DetectionInPolygon, Polyline, ObjectDetectionComponent, ALPRComponent, Loitering
"component_id": "component_123",
"start_timestamp": 0,
"end_timestamp": 2556143999000,
"window_time_mode": "absolute",
# "classes": ["vehicle", "person"] # Optional
}
headers = {
"x-api-key": "your-api-key-here",
"Content-Type": "application/json"
}
body = {}
response = requests.get(url, headers=headers, params=params, json=body)
print("Status code:", response.status_code)
try:
print("Response JSON:", response.json())
except Exception as e:
print("Error parsing JSON:", e)
print("Raw response text:", response.text)
JavaScript:
const url = "https://metrics.dt-app.com/first_detection";
const params = {
"pipeline_id": "00000000-0000-0000-0000-000000000000",
"component_name": "DetectionInPolygon",
// Available values : PolylineWithDirection, DetectionInPolygon, Polyline, ObjectDetectionComponent, ALPRComponent, Loitering
"component_id": "component_123",
"start_timestamp": 0,
"end_timestamp": 2556143999000,
"window_time_mode": "absolute"
// "classes": [] Optional
};
const queryString = new URLSearchParams(params).toString();
const fullUrl = `${url}?${queryString}`;
const headers = {
"x-api-key": "your-api-key-here",
"Content-Type": "application/json"
};
const body = {};
console.log(`Sending request to: ${fullUrl}`);
fetch(fullUrl, {
method: 'GET',
headers: headers,
body: JSON.stringify(body)
})
.then(response => {
console.log("Status code:", response.status);
if (!response.ok) {
return response.text().then(text => {
throw new Error(`HTTP error! status: ${response.status}, body: ${text}`);
});
}
return response.json();
})
.then(data => {
console.log("Response JSON:", data);
})
.catch(error => {
console.error("Error:", error);
});
Curl
curl -X GET \
'https://metrics.dt-app.com/first_detection?pipeline_id=PIPELINE_ID&component_name=DetectionInPolygon&component_id=COMPONENT_ID&start_timestamp=0&end_timestamp=2556143999000&window_time_mode=absolute' \
-H 'x-api-key: your-api-key-here' \
-H 'Content-Type: application/json' \
-d '{}'