The Rose server for StreamLab supports a simple API.
Note: Wherever is included in the URL, this represents the rose username. At the moment only one user is supported (called user).
Supported options include:
|/_help||Get||HTML – help for the rose api|
|/_project//||Get||JSON project definition (The rose file, not the slab file, so excludes all dashboards)|
|/_projects/||Get||JSON array of project elements for the user|
|/_project_script//||Get||SQL - entire project script for the user|
|/_project_start//||Get||SQL – script to start project pumps|
|/_project_stop//||Get||SQL – script to stop project pumps|
|/_project_removal//||Get||SQL – script to drop project|
|/_download//||Get||JSON – the project slab file Must run /_project_export first|
|/_project_export//||Get||JSON containing the _download URL Must be run before /_download|
|/_project_dashboards//||Get||Returns a shell script with embedded dashboards: •Pipe this into bash to get them separated•Dashboards need to have been actually materialized in StreamLab (by viewing them)•Dashboards need to have been saved•The StreamLab project must have been saved after the dashboard is saved|
|/_project_export_delete//||Get||Deletes the slab file that is created on the rose server by /_project_export|
|/_project_rename///||Get||Renames the project; does NOT change the project schema. Returns ‘false’ (meaning success) or an error message|
|Entrypoint||Type||Post document contains|
|/_project//||Post||JSON project to be uploaded|
|/_project//||Del||Delete the project|
To get the project SQL from a project called t which is saved on localhost:
curl -o t.sql http://localhost:5585/_project_script/user/t
To get the dashboards for a project called buses:
curl http://localhost:5585/_project_dashboards/user/buses | bash
Note: You can use Wget as an alternative to curl
These APIs can easily be packaged into a script to save SQL, JSON and SLAB files into a suitable location (including into source control)
You do not need to login to the StreamLab server command line, or to have any specific software installed.
You can also automate these scripts.
Provides options for loading project components into a remote StreamLab or s-Server instance (so it is easy for example to build that into a docker or vagrant startup)
The Rose server has to be up and running for these components to be extracted. To use these with source control, you will either need to export them all from the development environment into source control or:
The dashboard export assumes that the caller is running in a Linux environment. If you are running Windows users, you may be able to use a Cygwin or Linux shell.
When you export dashboards, they have auto-generated names. For example, within StreamLab the dashboard may be given a generated URL such as:
When extracted using /_project_dashboards the name is flattened to:
If you want meaningful names to appear in the s-Dashboard menu, you will need to add some kind of file rename mechanism to your extract script.
Dashboard information also includes no reference to the StreamLab project name or pipeline name or the type of dashboard included. That is, the dashboard does not indicate whether it is a “quickie” dashboard generated from a step in a pipeline (the grey icon available in each step) or a dashboard defined as a step in a pipeline (the pink eye icon). In the first case, the existence of the dashboard is indicated by turning the light grey eye icon dark grey. In the second case the icon is turned pale pink when the dashboard is generated, and then a darker pink once the dashboard has been saved.