Application Enhancement
Application Settings > Program Extensions allows you to add extension scripts to your application.
Developer mode must be enabled in order to use the program extensions.
Constant registration
Replaces any character (variable name) in the action extension program with the specified value before execution. Variables with the same name are given higher priority.
- Click the [+add] button
- Click the [edit] button (pencil mark) to display the settings field
- Set the variable name (characters to search for), description, and replacement value
- Click the [*save] button
Default constant
The following constants are always available:
Constant | Description | Usage Example |
---|---|---|
{HEXA_API_SERVER} | URL to API server | http://{HEXA_API_SERVER}/' + url; |
{HEXA_API_TOKEN} | Login user's token, starting with Bearer | 'Authorization': '{HEXA_API_TOKEN}' |
{HEXA_CLIENT_IP} | Global IP of logged in user |
Function
Functions (function scripts) are extension scripts that can be added per application. Functions let you run code without being managed by a server or container. After registering the extension script, executing the API will execute the corresponding code.
- Click the [+add] button: Launch the function script editor and add new code
- [Edit] button (pencil mark): You can edit the existing code
Function script editor
You can add or edit extension scripts.
When adding or editing, specify the function name and function ID.
Function script API call
End point
/api/v0/applications/:project-id/functions/:function-id
payload
{
"key1" : "value",
"key2" : "value"
}
All the JSON of the specified payload will be passed to the script's data.params.
response
{
data: {}, // The value returned by the script will be returned
erros: [] // If an error occurs in the script, the error message is returned
}