Invoke a Function at the Edge
Manually
`POST /support/faas/functions`
With request body that the function code expects.
On a Schedule
Functions can be invoked on a schedule using a cron format. In this case there will be no request body. An optional callback URL can be used where the result can be posted (no auth possible on the callback URL).
`POST /functions/faas/schedules`
```
{
"function": "<function-name>",
"cron": "0 * * * *",
"callback_url": "https://example.com/callback"
}
```
On a Telemetry Trigger
- A so-called trigger needs to be defined for specific topics
-
The function itself needs to have the topics added on creation or update
A trigger basically defines which topics should have telemetry data used to invoke functions. Each function using that topic will be invoked.
`POST /functions/faas/triggers`
```
{
"topics": [
"things/<thing-uid>/properties"
],
"callback_url": "https://example.com/callback"
}
```
The callback URL is optional, like it is for schedules.
- things/{thing-uid}/properties
- things/{thing-uid}/properties/{property-key}
- things/{thing-uid}/actions
- things/{thing-uid}/actions/{action-key}
- things/{thing-uid}/events
- things/{thing-uid}/events/{event-key}
The + wildcard is supported for the thing-uid, property-key, action-key, and event-key. When not using a wildcard, the key needs to exist at the edge.
- X-Thing-ID (the thing’s UID)
- X-Message-Type (properties/actions/events)
- X-Message-Key (the property key, action key or event key)