Ir al contenido

Conector HTTP/REST

El conector HTTP permite la comunicación con APIs REST y servicios web.

Tipos de Conector:

  • HttpReader - Sondear endpoints HTTP (solicitudes GET)
  • HttpWriter - Enviar datos a endpoints HTTP (POST, PUT, DELETE)

Sondear un endpoint HTTP periódicamente:

{
"type": "HttpReader",
"config": {
"endpoint": "http://api.example.com/data",
"pollingRate": 5000,
"method": "GET",
"headers": {
"Authorization": "Bearer TU_TOKEN",
"Accept": "application/json"
}
}
}

Enviar datos vía POST:

{
"type": "HttpWriter",
"config": {
"endpoint": "http://api.example.com/data",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer TU_TOKEN"
}
}
}

Actualizar datos vía PUT:

{
"type": "HttpWriter",
"config": {
"endpoint": "http://api.example.com/data/123",
"method": "PUT",
"headers": {
"Content-Type": "application/json"
}
}
}
  • endpoint: URL completa incluyendo protocolo
  • method: Método HTTP (GET, POST, PUT, DELETE)
  • pollingRate: (Solo lector) Intervalo de sondeo en milisegundos
  • headers: Encabezados HTTP personalizados (objeto)
  • timeout: (Opcional) Timeout de solicitud en milisegundos
{
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer token",
"Accept": "application/json",
"User-Agent": "Meddle/1.0"
}
}
{
"type": "HttpReader",
"config": {
"endpoint": "https://api.weather.com/v1/current?location=factory",
"pollingRate": 300000,
"method": "GET",
"headers": {
"API-Key": "tu-api-key"
}
}
}
{
"type": "HttpWriter",
"config": {
"endpoint": "https://hooks.example.com/webhook",
"method": "POST",
"headers": {
"Content-Type": "application/json"
}
}
}
  • MQTT - Alternativa de mensajería IoT
  • Reshape - Transformar respuestas HTTP