Skip to end of metadata
Go to start of metadata

The Plugin API GUI page is accessible from Administration tab. It allows creating, editing and deleting of Reaction scripts. It is possible to directly execute scripts or schedule the execution of scripts.

UI Reference

  1. Upload Script
  2. Create new Script
  3. Quick search
  4. Enable/Disable Scipt
  5. Name clickable, opens the script in the editor
  6. Script runs at scheduled times
  7. Script affects these Building Block Types
  8. Actions column (Execute, Download Script, Show Log, Delete)

Uploading a Script

After clicking Upload button (1) a dialog for uploading new scripts is opened.

By clicking browse you can choose scripts in .js or .txt format. To upload a new script you have to enter a name, other attributes are optional.

Invalid Cron Syntax

If the Cronjob syntax for scheduling the execution is invalid, the script cannot be uploaded. See Cronjob Syntax

Creating new Script

By clicking the New button (2) an editor for script code will be opened. 

It is possible to directly write your reaction script in the window. Your code has to be written in JavaScript code. Reserved words for plugin API will be highlighted in the code editor. Once you have finished your script click "Save as". 

Enabling and Disabling Scripts

If a script is enabled it either constantly listens for changes (subscription scripts) or will be executed on schedule (direct execution scripts). 

Scripts that are disabled are neither listening nor being executed on schedule. Nevertheless they can be triggered manually by clicking "Execute".

Scheduling Script Execution

Every enabled reaction script can have a scheduled execution. The schedule can be set during script upload or directly in the list. Schedule input only supports Cronjob syntax for scheduling and will not be saved if it is invalid.

Some Cronjob examples might look like:

  • 0 15 10 01 * ?       Fire at 10:15 AM on the 1st day of every month
  • 0 0 12 1/5 * ?       Fire at 12 PM (noon) every 5 days every month, starting on the first day of the month
  • 0 11 11 11 11 ?     Fire every November 11 at 11:11 AM

For Cronjob scheduling tutorial and examples visit this page.

Invalid Scripts

If a script is syntactically invalid, it will be automatically disabled in the list and a warning icon will be displayed in front of the name. The execute button is inactive and after editing this script a message describing the error will appear.

Action Column

Actions column has four types of action:

  • Directly execute script
  • Download script
  • Show logs for script
  • Delete script

The script can be directly executed even if it is disabled but it must have valid syntax otherwise the button will be disabled.

Logs

Every script execution will log its start and end time in the database. Additionally function api.printLog(string message) will print this message to database.

LOG action button (8) will show all logged messages for a specific script. If there are no logs, the dialog will not be opened and proper message will appear.

From the Log dialog all log entries can be copied to clipboard or deleted.



  • No labels