Zum Hauptinhalt springen

Control Nooxl Apps with the model-calculate REST API

A REST API defines the rules for exchanging data between applications over the internet. The Nooxl REST API uses JSON and makes it easy to integrate with third-party services such as Microsoft Power Automate, Zapier, Zoho Flow, or HubSpot Operations Hub.

The model calculate endpoint opens a selected model with a selected dataset, enters data, optionally saves, and returns calculated values.

What happens on a call

  1. Authorization — a shortened Nooxl App GUID is part of the URL; the API token identifies the user and verifies their assignment to the app.
  2. Model selection — the body's model name or model id picks the model; the user's open permission is checked.
  3. Dataset selection — data label names (or ids) pick the dataset. Their order must match the order in the app.
  4. Load — the user's read right is checked; the latest model version opens with the dataset and is calculated.
  5. Input — if an input area was passed, values are entered into input cells (verified by the input color, with any actions triggered) and the model recalculates.
  6. Save — if the save option is set and the user has write rights, data is stored.
  7. Output — requested ranges are read and returned; the model closes.

Reading parameters from the app

After selecting a model and dataset in the app, the URL exposes the parameters you need: the web host, the app id (nooxlAppNuid), the modelId (or model name), and the dataset selections' dataLabelId (or dataLabelName). The app id has no name alternative.

Screenshot placeholder

  • 1 The Nooxl web host (not the API host).
  • 2 The app id nooxlAppNuid.
  • 3 The modelId (or use the model name).
  • 4 The dataset selections' dataLabelId (or dataLabelName).

Input and output ranges are referenced by their markup name, visible in the Tools list to authorized users in Design mode.

Request

POST https://{nooxlApiHostName}/api/v1/app/{nooxlAppNuid}/ModelCalculate

Send the Authorization: Bearer {token} header (from authenticate). The body sets inputs (dataInputs), outputs (dataOutputMarkupNames), and options (modelOptions):

model calculate - request body
{
"modelName": "Cash flow",
"modelSelections": [
{ "dataLabelName": "2024-01" },
{ "dataLabelName": "Asset A" }
],
"dataInputs": [
{ "markupName": "Usage Inputs",
"cellValues": [
["810","16","","20.00","4%"],
["245","4","","25.75","4%"]
]
}
],
"dataOutputMarkupNames": [
"Total annual revenue Outputs", "Total annual expense Outputs"
],
"modelOptions": { "saveModel": true }
}

cellValues is a two-dimensional array (rows of columns). With "saveModel": true the model is saved if the user is permitted.

The complete OpenAPI (Swagger) definition is available for download from the live docs.

Response

model calculate - response body
{
"dataOutputs": [
{
"markupName": "Total annual revenue Outputs",
"cellValues": [
["477,715.82","493,584.47","502,651.10"]
]
}
],
"errorCodes": []
}

Output values come back in dataOutputs[].cellValues as a two-dimensional array.

note

On the demo app the API-Tester user has no save permission, so saveModel has no effect there.