/graphql endpoint of the
REST API.
See GraphQL API reference for the list of supported
requests and parameters.
Configuration
GraphQL API is enabled by default and secured using API scopes and CORS. To disallow access to GraphQL API, disable thegraphql
scope, e.g., by setting the CUBEJS_DEFAULT_API_SCOPES environment variable to
meta,data.
To find your GraphQL API endpoint in Cube Cloud, go to the Overview
page, click API credentials, and choose the GraphQL API tab.
Getting started
As an example, let’s use theorders cube from the example eCommerce database:
Modifying time dimension granularity
The granularity for a time dimension can easily be changed by specifying it in the query:value:
Specifying filters and ranges
Filters can be set on the load query or on a specific cube. Specifying the filter on the load query applies it to all cubes in the query. Filters can be added to the query as follows:numbervalues are used for number types instead of strings- The
notSetfilter is replaced by{ set: false } - New
inandnotInfilters to check for multiple values ANDandORfields for boolean operators
@skip and @include directives too:
Querying multiple cubes
Using the sameorders cube as before, let’s try and get the numbers of
products for each order status too. We can do this by adding the products cube
to our query as follows: