Skip to content
MyAppBuilder
StableGuide

Response mapping

An API answers with JSON — often more than you need, nested a few levels deep. Response mapping picks the part you want and tells the data picker which fields exist, so you can bind a table, a text or a later action to the result by name.

Response mapping

An API answers with JSON — often more than you need, nested a few levels deep. Response mapping picks the part you want and tells the data picker which fields exist, so you can bind a table, a text or a later action to the result by name.

When to use

  • The list you want is inside data.items or results.
  • You want to bind a Text to one value such as current.temperature.
  • Later actions or workflow steps should read a specific field from the result.

Response path

Set Response path in the API's Response & access section to a dot path into the JSON. Everything downstream (bindings, actions, workflow steps, the test preview) sees only that part. Leave it empty to use the whole response.

Example
Response:  { "status": "ok", "data": { "items": [ { "id": 1, "name": "Boiler" }, … ] } }
Response path: data.items
Mapped result: [ { "id": 1, "name": "Boiler" }, … ]

Paths go through objects (a.b.c); the first element of a list is used when inferring fields. Non-JSON responses are kept as text.

Saving fields for the data picker

  1. Run Test request with realistic parameters.
  2. Under Detected fields, click Save fields for the data picker. Up to 200 field paths (3 levels deep) are stored with the API.
  3. From now on, the picker offers API › Weather › temperature instead of a free-text path.

Fields are only names; re-run the test and save again when the service changes its response.

Binding components to an API

  1. Select a Table, Cards, Repeater, Gallery or Chart and open the Data tab.
  2. Choose API and pick the source.
  3. Items path: the path to the list within the mapped result, for example items. Leave empty when the mapped result is already a list.
  4. Map columns and fields with the picker, using the saved fields.
  5. For a single value, bind a Text or KPI with API › source.path.

Bindings load when the page opens (the Refresh data action reloads entity data, not API bindings). They pass no parameters; for parameter-driven requests use the Call API action and show the result from its result key.

Using results in actions and workflows

  • Call API action with Save result as weather: later actions use Result › weather.temperature or {{results.weather.temperature}}.
  • Call API workflow step with Save result as api: later steps use Action results › api.items — loop over a list with Repeat for each ({{event.item.name}} inside the loop).
  • Only the mapped data is saved under the result key; the HTTP status is not available to later actions.

Common mistakes

  • Response path pointing at a single object when a list is needed (or vice versa). Check the test preview: it shows the mapped result.
  • Items path repeating the response path. The items path is relative to the mapped result.
  • Fields that depend on the first item. Detected fields come from the first list item; optional fields missing there are not listed but still work when typed as a path.
  • Expecting transformation. Mapping selects; it does not rename, compute or filter. Use Set values in workflows for simple derivations, or filters on the component.

Advanced

executeApiSource parses JSON when the content type contains json or the text starts with {/[, then applies getByPath(data, responsePath). inferFields(sample) walks up to depth 3 and 150 paths; the builder stores at most 200 names in responseFields. Bindings of type { type: "api", apiSourceId, path } resolve the list via the runtime's cached loader.

Related

Was this helpful?