Connect from Cube Cloud
Navigate to the Integrations page, click Connect to Cube, and choose Bubble to get detailed instructions.Connect from Cube Core
You can connect a Cube deployment to Bubble using the REST API. For a Cube instance publicly available at a specificHOST, the REST API URL
would be HOST/cubejs-api/v1. Please refer to the
REST API page for details.
You will also need to generate a JSON Web Token that would be used to
authenticate requests to Cube.
Please check the Security page
to learn how to generate a token. We suggest generating a long-lived JWT that
won’t expire soon.
Connecting from Bubble
Add an API connector plugin
Navigate to the plugins. Select and install the API connector plugin.Create a new API
Click “Add another API”.content-type to application/json.
Create a POST request
Click “Add another call”. Copy and paste the Cube REST API, including the/load path, in the API field.
Make sure to select “Use as: Action”, and use the JSON “data type” and “body
type”.
query parameter for
your JSON query.
Create a workflow
First, add a “Page is loaded” event. Add an action that uses the API connector plugin. Next, add another action to set the state of an element. Select the index element, and create a new custom state. In this example I named the custom stateOrdersByMonth and selected the data field of the API response. Make
sure to toggle the “This state is a list” checkbox as well. While setting the
state’s value you will need to select “Result of step 1” and the data field.
Display the data
Bubble has an amazing feature where you can drag and drop UI components into the design dashboard. Once you added a chart, you configure the data points. More specifically, the series categories and series data. For the series categories and series data you need to select theindex and OrdersByMonth state followed by the data point
you want to use in order to populate the chart.