Response mapping

To receive data from the ISV service and display it in elements of a CyberApp form, we specify how the data received in the callback response payload is mapped to the model.
This is called response mapping.

With response mapping, the callback response payload is on the left side, and the form model is on the right side.
../../../_images/ss-uibuilder-responsemapping.png

Note

A common scenario for response mapping is with Data initializer callbacks.

To define response mapping

  1. Click Add mapping.

  2. Select a callback response payload data item from the left-side mapping dropdown list, and the form model element you want to map it to from the right-side mapping dropdown list.

  3. Repeat for all the data items you want to display in the form.

Note

If you make a mistake, you can change the selected items or click the delete button to delete the mapping.

Example

../../../_images/ss-uibuilder-responsemapping1.png

In this example, getusers has been specified as a root form’s Data initializer callback. The getusers callback has a response payload:

{
  "type": "object",
  "$schema": "http://json-schema.org/draft-04/schema",
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          }
        }
      }
    }
  }
}
A response mapping is therefore expected to map three strings from the getusers callback response payload schema.

In this case, the array is mapped with a table element which has been created with the appropriate columns.