Skip to content

Document API template paging and child calls in Preview - #772

Open
kilian-tennyson wants to merge 5 commits into
mainfrom
kiliantennyson/parthas/30e5dbdd-document-api-template-paging-and-child-calls-in-preview
Open

kilian-tennyson wants to merge 5 commits into
mainfrom
kiliantennyson/parthas/30e5dbdd-document-api-template-paging-and-child-calls-in-preview

Conversation

@kilian-tennyson

@kilian-tennyson kilian-tennyson commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Why?

The Preview API template docs are out of date. They still say a sync sends one tree request and that paging isn't supported, they still describe template variables, and they mark fields as required that now have defaults. Templates are written against this reference, so wrong docs lead to templates that fail to create or sync.

How?

All changes are in the Preview spec (descriptions/0).

  • Paging and child calls: documents tree.paging and tree.child_calls, with their checks and error codes. paging has three styles: page_number (with page_count), offset (with total) and cursor (with next_cursor). The sync text covers whole-tree listing, the per-try limits, how depth counts across child calls, and 404 handling.
  • Undeclared paging: a call without paging whose response says it has more pages fails the sync. If the tree call does this during the token check, the source isn't created. The docs list the response fields that count as "has more".
  • Variables removed: variables is gone from the template, the create request and the source response. Values are written into the template itself. Sending variables fails with a 422. Placeholders are now filled only from node_values in the item request and child calls.
  • Defaults: auth defaults to Authorization: Bearer {token} (no header when a query value is {token}). Without content_if, every node is content. body_format defaults to html. item is optional, and without it mapping reads only from node. Only name, base_url, tree and mapping are required. A stored template is returned without the defaults filled in.
  • Create errors: adds examples for a missing mapping.updated_at, for variables being sent, and for undeclared paging.
Decisions
  • mapping.updated_at is documented as required at create, because the create check requires it today.
  • mapping.metadata is accepted on create but isn't documented yet, because what it does isn't available yet.
  • The automatic-sync sentences in latest_sync and the sync endpoint are unchanged. They were already incomplete about 403 and first-page 404 responses, and fixing them is outside this change.

Adds tree.paging (page_number) and tree.child_calls to the api_template schema with their checks, and updates the sync text: whole-tree listing, 404 handling, per-try listing and request limits, how depth counts across child calls, and the X-RateLimit-Reset header.
Templates no longer take variables: values are written into the
template, placeholders come only from a call's node_values, and
sending variables fails the create request. The examples inline
their values and the source no longer returns variables.

tree.paging and child call paging accept the page_number, offset and
cursor styles, each with its own key. A list without paging whose
response says it has more fails the create request and the sync.

auth, tree.content_if, body_format and item can be left out, mapping
can read everything from the node when there is no item, and a
missing mapping.updated_at fails the create request.
Gives paging its own sentence in the api_template overview, lists which failed requests make Intercom retry a sync, and documents the base_url invalid check for a host whose percent-encoding isn't valid UTF-8.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant