Call a third-party REST API from a model
To start processes outside Nooxl Apps, a model can call an external REST API and pass data out. You first create a REST API connection and a data query with parameters in Data integration, then use it in a model through a query section.
Set up the data integration
Open Data integration under the app tab and, in Design mode, create the connection, command, and parameters.
- 1 Create the data integration.
- 2 Edit the connection.
- 3 The data-query command.
- 4 The data-query parameters.
Connection — choose connection type REST_API. The connection string is a JSON with
headers and url; use {{parameter name}} placeholders, defined in the parameter step.
Command — choose NO_RESULT. The command text is a JSON with method and body
(currently only post); it can also use {{parameter name}} placeholders.
Parameters — the parameter name in {{ }} is replaced in both the command text and
the connection string with values from a model (or the default). A CellRange passes a
string array of rows of columns. Options:
| Option | Effect |
|---|---|
| Optional | The parameter need not be assigned in the model section. |
| Not modifiable | The parameter cannot be assigned in the model; the default is always used. |
| Allow null values | Null values are not treated as an error. |
Use it in a model section
In the model you need three markups: two parameter ranges and one trigger range. Then add a query section and configure it:
- 1 Choose the data connection.
- 2 Choose the command and its parameters.
- 3 Map markups to parameters so values are read from the model.
- 4 For
CellRangeparameters set options (Text, Headers, Types). - 5 Set the trigger (for example on cell click or on save).
Trigger the call
At run time the user can, for example, set the relevant cells and click the trigger cell; the third-party API is then called with the model's values.