Send parameters and body data with API requests in Tweakwise External Data Components
The External Data Component data source configuration enables you to send data along with your external requests. You can add query and path parameters to a request and specify their values. You can also add body data to a request.
Send request parameters
You can specify path and query parameters for a request using the URL box. Query parameters are appended to the end of the request URL, following ? and listed in key-value pairs, separated by & as follows: ?id=1&type=new
Send body data with requests
In addition to using parameters in the URL, if the component is configured to use POST as request method, then we'll send the context to the external source as JSON in the body of the request. To allow a more flexible POST body, the Context can be mapped into the actual expected Mapping result, using JSONata.
This can be configured in the Body tab:
- Mapping: the function that will transform The Context to your desired POST body result.
- Mapping result: the actual POST body that will be sent to the external source. The placeholder values will be replaced by values of The Context when our navigation endpoints will do requests to this external source.
- Values: you can specify concrete values in order to test and validate the data source connection in the app.
Updated 2 months ago