Automatizaciones
Obtener métricas de una automatización
Lee los totales históricos de activaciones y mensajes directos, además de los DMs de los últimos siete días, para una automatización de Instagram.
GET
/
api
/
v1
/
automations
/
{automationId}
/
metrics
Get automation metrics
curl --request GET \
--url https://levios.app/api/v1/automations/{automationId}/metrics \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://levios.app/api/v1/automations/{automationId}/metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://levios.app/api/v1/automations/{automationId}/metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"error": {
"code": "api_invalid_content_length",
"message": "Invalid Content-Length.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_unauthorized",
"message": "Authentication required.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_account_not_granted",
"message": "This credential is not authorized for the request.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_automation_metrics_not_found",
"message": "The requested automation metrics were not found.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_body_too_large",
"message": "The JSON request body exceeds 1 MiB.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_unsupported_media_type",
"message": "Content-Type must be application/json.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_validation_error",
"message": "The request does not match the declared schema.",
"correlation_id": "<string>",
"details": {
"issues": [
{
"code": "<string>",
"path": [
1
]
}
]
}
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_internal_error",
"message": "The request could not be completed.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_metrics_read_unavailable",
"message": "The automation metrics could not be read.",
"correlation_id": "<string>"
}
}Usa este endpoint para medir una automatización. Pasa el ID de la
automatización en la ruta y un
account_id accesible en la cadena de consulta.
Tu clave de API necesita el permiso metrics:read.
La respuesta contiene:
automation_id: la automatización cuyas métricas se consultaron.activations_total: total histórico de activaciones correctas de la automatización.dms_total: total histórico de intentos de mensajes directos enviados.dms_last_7d: intentos de mensajes directos enviados durante los últimos siete días.last_fired_at: marca de tiempo del evento procesado correctamente más reciente, onullsi la automatización nunca se ha ejecutado.
Solicitud de ejemplo
curl --get \
--url "https://levios.app/api/v1/automations/${LEVIOS_AUTOMATION_ID}/metrics" \
--header "Authorization: Bearer ${LEVIOS_API_KEY}" \
--data-urlencode "account_id=${LEVIOS_ACCOUNT_ID}"
Get automation metrics
curl --request GET \
--url https://levios.app/api/v1/automations/{automationId}/metrics \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://levios.app/api/v1/automations/{automationId}/metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://levios.app/api/v1/automations/{automationId}/metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"error": {
"code": "api_invalid_content_length",
"message": "Invalid Content-Length.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_unauthorized",
"message": "Authentication required.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_account_not_granted",
"message": "This credential is not authorized for the request.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_automation_metrics_not_found",
"message": "The requested automation metrics were not found.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_body_too_large",
"message": "The JSON request body exceeds 1 MiB.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_unsupported_media_type",
"message": "Content-Type must be application/json.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_validation_error",
"message": "The request does not match the declared schema.",
"correlation_id": "<string>",
"details": {
"issues": [
{
"code": "<string>",
"path": [
1
]
}
]
}
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_internal_error",
"message": "The request could not be completed.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_metrics_read_unavailable",
"message": "The automation metrics could not be read.",
"correlation_id": "<string>"
}
}
