Creating Internal and External APIs
A DashBoard API is a collection of ogScript functions:
•An internal API exists within a CustomPanel. Its functions are available only within its CustomPanel.
•An external API is stored in a separate API script file, which can be referenced by any CustomPanel that can access the API script file.
You can create APIs to facilitate reuse of your custom functions.
Internal APIs
An internal API contains functions that are made available within the current CustomPanel.
To create an internal API:
1.In the Component Tree, in the Insert Tag area, click <api/>.
The Visual Logic editor appears. A new api item appears in the Component Tree.
2.Create one or more new functions, giving each a meaningful name so they are easily referenced from other parts of the CustomPanel.
For more information, see Creating New Functions.
The functions are automatically made available to be used in any segment of ogScript within the CustomPanel.
External APIs
An external API contains functions that are stored in an API script file, which can be referenced by any CustomPanel that can access the API script file.
The API script file must be a text file containing only valid ogScript (JavaScript).
To create an external API:
1.Create valid ogScript code that you want to save as your external API:
•Using a text editor — You can use any text editing or code editing tool.
•Using DashBoard — You can write the code in the ogScript editor, or use Visual Logic editor and then view the code on the Source tab. Copy the code and paste it into a text editor.
2.Save the API script file.
You can use any file extension, but we recommend using .ogscript. For example, myAPI.ogscript.
3.Place the file on the same network as the DashBoard computers that will use the API.