Labels: :IA_Function:IA_API
Inherits from: Function

Creates an API endpoint, that can be called from visual components.


Key Description Default value Possible values
response When set (for the first time), the API Function returns its value as response to the caller. any

Note: in the Trigger that sets the response, $_instance should be set to (%)._path.apiInstance (see Example Usage).

Outgoing triggers

Type: request

Occurrence: When the API endpoint gets requested.

Additional event properties (besides the inherited properties):

Key Description Possible values
input The input provided to the API request. object

Example usage

An API endpoint is created by an :IA_API:IA_Function node with an iaName property, e.g.:

	"iaName": "myAPI"

The API endpoint can then be called from a visual component, e.g. (an Html component):

<ia-api ia-name="myAPI" input-myInput="myInputValue"></ia-api>

The html component above will call the myAPI endpoint, executing the IA_API node above. The API Function will then fire a request trigger with

	"type": "request",
	"input": {
		"myInput": "myInputValue"

Now, a whole chain of Functions can be executed to get the desired result, which should then be fed back to the IA_API node with a trigger containing a $response parameter and an $_instance parameter, e.g.:

	"type": "someTriggerType",
	"$response": "My Final Response Value",
	"$_instance": "(%)._path.apiInstance"

Note: Behind the screens, the IA_API is executed with a unique instance ID, which is stored in _path.apiInstance during the API execution chain. The final Trigger containing the response will then have to update the original API instance. The parameter "$_instance": "(%)._path.apiInstance" therefore needs to be present in this Trigger.

When the original API Function gets updated, it causes the response to be given back to the caller and, in this case, the value of $response will then be filled into the <ia-api> html component.