Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Pagination and lookups

Pagination

Add paginate: to a list operation (or a lookup, or a poll trigger). The runtime then fetches pages until a stop condition is met, collects the elements from each page, and handles the return_all / limit parameter pair.

params:
  - { name: return_all, type: boolean, default: false }
  - { name: limit, type: number, default: 50 }
paginate:
  strategy: cursor
  items: "$.results"
  # strategy-specific keys below
  max_pages: 100
  max_items: 50000

With return_all: false, fetching stops as soon as limit elements are collected, and the output is truncated to limit.

Strategies

StrategyKeysTypical API
cursorcursor_from (JSONPath in the body, or header:<name>), cursor_param, cursor_in (query or body)next_cursor, response_metadata.next_cursor, after
token_in_bodySame as cursor, with the token in the request bodypageToken in a POST search body
next_urlnext_url_from (JSONPath to an absolute URL)"next": "https://api.example.com/items?page=3"
link_headernoneLink: <...>; rel="next" (RFC 8288)
offset_limitoffset_param, limit_param, page_size, start (default 0)?offset=200&limit=100
page_numberpage_param, page_size_param, page_size, start (default 1)?page=3&per_page=100

Templates in the request can use page.index, page.number, page.offset and page.cursor when the API needs them somewhere unusual:

request:
  method: GET
  path: /items
  query: { page: "{{ page.number }}", per_page: 100 }
paginate:
  strategy: page_number
  start: 1
  items: "$.items"
  has_more: "{{ response.body.has_more }}"

Stop conditions

Pagination stops at the first of:

  • the cursor or next URL is missing or empty,
  • a page has no elements,
  • has_more is given and evaluates to false,
  • a page is shorter than page_size (when page_size is set),
  • max_pages (default 100; hard cap 10,000) or max_items is reached,
  • limit is reached when return_all is false.

Lookups

Lookups fill dropdowns (options / multi_options parameters with lookup:) and the list mode of resource locators. The editor calls POST /api/v1/connectors/{id}/lookups/{lookup} with the selected credential, the current parameter values, a search string and a cursor.

lookups:
  channels:
    request:
      method: GET
      path: /conversations.list
      query: { limit: 200, types: "public_channel,private_channel", exclude_archived: true }
    paginate: { strategy: cursor, cursor_from: "$.response_metadata.next_cursor", cursor_param: cursor }
    items: "$.channels"
    label: "#{{ item.name }}"
    value: "{{ item.id }}"
    description: "{{ item.purpose.value }}"
    url: "https://app.slack.com/client/{{ item.context_team_id }}/{{ item.id }}"
    search: client
KeyDescription
request, paginateAs for operations. Lookups go through the same auth, rate limits and egress policy.
itemsJSONPath to the array of entries.
label, valueTemplates over item.
description, urlOptional templates shown in the list.
searchclient filters the fetched entries by label; server sends the search text as search_param.
search_paramQuery parameter for server-side search.
depends_onParameters this lookup reads; the editor refreshes it when they change and disables it until they are set.

Results are cached for 60 seconds per credential, lookup and parameter values.

Dependent lookups

lookups:
  spreadsheets:
    request:
      method: GET
      url: https://www.googleapis.com/drive/v3/files
      query: { q: "mimeType='application/vnd.google-apps.spreadsheet' and trashed=false", pageSize: 100 }
    paginate: { strategy: cursor, cursor_from: "$.nextPageToken", cursor_param: pageToken }
    items: "$.files"
    label: "{{ item.name }}"
    value: "{{ item.id }}"
    search: server
    search_param: q
  sheets:
    depends_on: [spreadsheet]
    request: { method: GET, path: "/spreadsheets/{{ params.spreadsheet | urlencode }}", query: { fields: "sheets.properties" } }
    items: "$.sheets[*].properties"
    label: "{{ item.title }}"
    value: "{{ item.title }}"

Resource locators

A resource_locator parameter has three modes in the editor:

ModeValue sent to the connector
From listThe value of the chosen lookup entry
By IDThe typed ID
By URLThe id group extracted by the parameter’s url_patterns
params:
  - { name: spreadsheet, type: resource_locator, lookup: spreadsheets, required: true }
url_patterns:
  spreadsheet: "docs\\.google\\.com/spreadsheets/d/(?<id>[^/]+)"

Imported workflows carry resource locator values as objects with a mode, a value and a cached display name. The importer unwraps them (resolving URL mode through url_patterns) and keeps the cached name for display, so the connector always receives a plain ID.