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.
Note
A common scenario for response mapping is with Data initializer callbacks.
To define response mapping
Click Add mapping.
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.
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 button to delete the mapping.
Example
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.