Endpoints are interfaces to executable ONE DATA resources - such as Workflows, Production Lines or Functions. They can be invoked based on an event, such as a button click.
These resources are defined in the Processing Library and can afterwards be used in Apps. This article provides information about the different Endpoint types that are available and shows their usage.
Property | Type | Description | Example Value |
id | string | The unique id assigned to the Endpoint. | "id": "TestEndpoint" |
type | string | Type of the Endpoint | "type": "workflow" || "productionLine" |
async | boolean | Defines the way the data will be updated. The data update callback is currently available only for FRT's | "async": true |
config (workflow) | object | Configuration of your Endpoint for Workflows. Version must be set to your current version (can be found in the URL "...versionNumber=3...") If you don't provide a version property, the latest version will be executed. Usage of target project ID for workflow execution: Workflow Endpoint configuration allows setting the | "config": { // Workflow ID "workflowId": "", // Project ID "projectId": "", // (Optional) Version of the // Workflow to execute "version": 0, // List of variable assignments "variableAssignments": [ { // Name of the variable "variableName": "variable_27S", // Type of the variable "variableType": "STRING", // Value of the variable "variableValue": "Test Value" } ] } |
config (productionLine) | object | Configuration of your Endpoint for Production Line | "config": { "productionLineId": "", // (Optional) Version of the // Production Line to execute "version": 0, // List of variable assignments "variableAssignments": [ { // (Technical) Name of // the variable "variableName": "pl_var", // Type of the variable "variableType": "STRING", // Value of the variable "variableValue": "Test" } ] } |
config (function) | object | Configuration of your Endpoint for Functions. (more information below) | "config": { "functionId": "some_ID", "payload": { "input": { "name": "", "$name": { "value": "{{user_name}}" } } } } |
Function Endpoints
With functions it is possible to implement complex logic in simple, single-purpose units that can be invoked by your app. They can be for example used to communicate with external services or execute short-lived, logically complex computations. Functions can be created in the Processing Library or Use Cases module of ONE DATA and can be currently written in Python. This section shows how functions can be defined as an Endpoint in Apps. For information on how to trigger a Function Endpoint and use it to customize user-facing messages, read on here.
In order to define an Endpoint for a Function, create an Endpoint with "type": "function"
. Its config
can look like this:
The payload.input
defines the argument that should be passed to the function as argument. Parts of the input can be parameterized with Variables to make the invocation dynamic based on the app state. In the above example the variable user_name
is used as value of the field name
of the Functions input object. The Function can be called with the resulting object by calling it via an Execute Button.
The configuration options relevant in this example are:
Property | Type | Description |
functionId | string | The ID of the Function that should be invoked via the Endpoint. |
payload.input | any | The argument that should be passed to the Function. It can be of any type (objects, strings, numbers, ...) and may be omitted if the Function does not expect parameters. |
Example
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article