Skip to Content
TaresConnectorsHTTP API (poll)

HTTP API (poll): http_poll

Polls a JSON endpoint on the source’s schedule and stores one event per item. The generic path for the APIs no other connector covers: a weather service, a status page, a SaaS export, an endpoint of your own. Nested values are reachable by dotted name everywhere, so a label, a view filter or a trigger can watch current_weather.windspeed.

The webhook connector is for systems that call Tares. This one is for APIs Tares calls.

Set up

Ask a connected agent, or describe the goal on the builder:

Tell me when Berlin gets storm winds, from a public weather API.

The builder proposes an http_poll source with the URL and polls it itself; no script on your side. discover_source reads one reply and fills in the rest.

The reply becomes events

  • payload_key points at the part of the reply that is the payload, e.g. data or data.items. Empty means the entire JSON. An object there is one event; a list is one event per entry.
  • event_time_field names the field holding the event’s time (ISO-8601 or epoch). Empty means the poll time.
  • id_field is the deduplication key: an item whose value was seen in recent polls is not stored again. Use the entry’s id for a list API, or the reading’s own time for a single reading that only changes every few minutes. Empty stores every poll.
  • event_type is the word views filter on and triggers count by, the same for every event; event_type_field takes it from a field of the item instead.
  • text_template is the event summary, one line per event with values from the payload in braces, dotted names included. Empty stores the payload’s JSON.

The payload is stored as received, so labels declared later can still reach every field.

Authentication

One credential travels in one header. credential holds the whole value and is stored as a secret, never returned by the API and never exported. credential_header names the header, Authorization by default:

config: url: https://api.github.com/user credential: Bearer ghp_xxx # a bearer token credential_header: Authorization
config: url: https://api.example.com/v1/readings credential: abc123 # an API key credential_header: X-API-Key

Other headers the API wants on every request go in headers, which is not secret.

Rate limiting

A polled API has limits. The connector:

  • refuses a poll under 10 seconds when the source is saved;
  • backs off on a 429 or any 5xx: no request is made until the wait is over, and the wait doubles from the poll interval up to an hour. A 429 with Retry-After uses that value. The source’s health says “rate limited by the API, next try at HH:MM”;
  • surfaces any other 4xx as a config error on the source’s health, with the status and a slice of the reply;
  • clears the backoff on the next good poll.

Configuration

fieldtypedescription
urlstringthe endpoint, query string included. Checked on save: http or https, a host, no spaces
methodGET | POSTdefault GET
bodyobjectPOST only: the JSON object to send
headersmapextra request headers, not secret
credentialstring, secretthe whole credential value, e.g. Bearer xyz or an API key
credential_headerstringthe header the credential is sent in (default Authorization)
payload_keystringthe key in the reply that holds the payload; empty for the entire JSON
event_typestringfixed event type (default api_reading)
event_type_fieldstringfield of the item to read the event type from
text_templatestringthe event summary, with {field} and {a.b} references
event_time_fieldstringfield holding the event’s time
id_fieldstringdeduplication key; empty stores every poll

Verify

Open the source: Recent events shows each poll’s events with the summary line; Fields lists every field seen, dotted names included, with its coverage. A trigger on a number label, max(windspeed) > 62 over 15m, fires from the next reading that crosses it.

Last updated on