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
Agent
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_keypoints at the part of the reply that is the payload, e.g.dataordata.items. Empty means the entire JSON. An object there is one event; a list is one event per entry.event_time_fieldnames the field holding the event’s time (ISO-8601 or epoch). Empty means the poll time.id_fieldis the deduplication key: an item whose value was seen in recent polls is not stored again. Use the entry’sidfor a list API, or the reading’s own time for a single reading that only changes every few minutes. Empty stores every poll.event_typeis the word views filter on and triggers count by, the same for every event;event_type_fieldtakes it from a field of the item instead.text_templateis 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: Authorizationconfig:
url: https://api.example.com/v1/readings
credential: abc123 # an API key
credential_header: X-API-KeyOther 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
pollunder 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-Afteruses 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
| field | type | description |
|---|---|---|
url | string | the endpoint, query string included. Checked on save: http or https, a host, no spaces |
method | GET | POST | default GET |
body | object | POST only: the JSON object to send |
headers | map | extra request headers, not secret |
credential | string, secret | the whole credential value, e.g. Bearer xyz or an API key |
credential_header | string | the header the credential is sent in (default Authorization) |
payload_key | string | the key in the reply that holds the payload; empty for the entire JSON |
event_type | string | fixed event type (default api_reading) |
event_type_field | string | field of the item to read the event type from |
text_template | string | the event summary, with {field} and {a.b} references |
event_time_field | string | field holding the event’s time |
id_field | string | deduplication 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.