Datasource Response is the way to handle the response of a Kodika Server request or an API Request, when the Datasource execution finishes. Note: Each Kodika Server Request or API Request can have more than one Responses, but only one is called for each Datasource execution.
Each Request type has specific Responses, which are described in each help section.
- User Data Type
- Other Server Data Types
You will need to manually add the API Responses for each API Request, and the Datasource will automatically list them in the Responses section.
Most of the Responses will also have at least one Response parameter. The server values automatically populate the values of the Response parameters, and you can bind them to different options to use/display them in your application. This feature is similar to the Update Design using Screen property feature. The difference is that we use the data of a Datasource Response and not of a Screen Property.
Design Element section lists all the design elements of your screen. The ones that can display the value to the selected parameter will show a + button. Using this option, you can directly show the server data in your design.
Screen Property section lists all the screen properties, and enables you to set the value of a Screen property from the value of the Response parameter.
Function section lists all the screen functions that have exactly one Function argument. Note: Function argument Data Type should match the Response parameter’s Data Type. Using this option, Datasource will automatically execute the selected Function and pass the Response Parameter value to the Function as a Function argument value.
Although there is no way to define a response as successful or error explicitly, Kodika automatically splits each response into these 2 categories based on some parameters.
Note: Error Response include both the responses that the server didn’t respond to or responded with an error code.
- Kodika Server: Each request has only one success response, the On Success. Every other response is marked as an Error Response.
- External API: Every response with status code <= 399 is a marked as a Success response. All the other responses, which include the ones that have status code => 400, the catch error, timeout and the offline, are Error Responses.
If a Response is marked as an Error Response and you don’t handle its parameters, Kodika will automatically present an alert to the user when this response is called.