Skip to main content

Module api_poll

Module api_poll 

Source
Expand description

The question a poll trigger asks when its query is api (docs/specs/SPEC_DRONE_REAL_WORLD_JOBS_2026_11_11.md §3.2): one GET of a site’s list, with an optional Vault credential, answered as the items in it.

The call is the API block’s own (super::api::run), not a second HTTP client, so a poll has the same site binding, the same refusal of a Host header, the same header handling, the same size cap and timeout, and a credentialed call follows no redirect (a 3xx is an error here, said so). What differs is one thing: a poll has nobody at the desk, so it never asks the person. With a credential it uses only an “Always” the person already gave this drone for this site (ExecutionScope::never_ask); without one it fails at once, with no card.

The filter keys: url (https, written out), auth (as the API block’s), headers, items (the dotted path to the list in the answer, empty when the answer is the list), id (the dotted path of an item’s id, id when left out), limit (at most that many items kept, 100 when left out). What comes back is outside text: each item is the answer’s own, and goes to the run as {{trigger.item}} like the API block’s output, with the same handling.

Functions§

ask 🔒
Asks the site filter["url"] for its list. filter["drone_id"] is the drone whose job polls, set by the poller: it is who a Vault credential is granted to.
at 🔒
The value at the dotted path of v; the value itself for an empty path. Array positions are numbers (a.0.b).
id_text 🔒
An item’s id as text: a non-empty string or a number.
items_in 🔒
The items in a successful answer’s body, each with its id: { "items": [ { "id": "…", "item": <the item> } ] }. An item with no id is not one. Pure, so it is testable without a server.
items_of_output 🔒
The items in the API block’s output: an error for any answer but a 2xx with a list in it.