Skip to content

Commit 68fe913

Browse files
committed
Docs
1 parent a49db4d commit 68fe913

File tree

3 files changed

+28
-23
lines changed

3 files changed

+28
-23
lines changed

docs/pages/product/apis-integrations/rest-api.mdx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ accessible for everyone.
161161
| API scope | REST API endpoints | Accessible by default? |
162162
| --- | --- | --- |
163163
| `meta` | [`/v1/meta`][ref-ref-meta] | ✅ Yes |
164-
| `data` | [`/v1/load`][ref-ref-load] | ✅ Yes |
164+
| `data` | [`/v1/load`][ref-ref-load], [`/v1/cubesql`][ref-ref-cubesql] | ✅ Yes |
165165
| `graphql` | `/graphql` | ✅ Yes |
166166
| `sql` | [`/v1/sql`][ref-ref-sql] | ✅ Yes |
167167
| `jobs` | [`/v1/pre-aggregations/jobs`][ref-ref-paj] | ❌ No |
@@ -248,9 +248,20 @@ should be unique for each separate request. `spanId` should define user
248248
interaction span such us `Continue wait` retry cycle and it's value shouldn't
249249
change during one single interaction.
250250

251-
## Troubleshooting
251+
## Cache control
252252

253-
### `Continue wait`
253+
[`/v1/load`][ref-ref-load] and [`/v1/cubesql`][ref-ref-cubesql] endpoints of the REST API
254+
allow to control the cache behavior. The following querying strategies with regards to
255+
the cache are supported:
256+
257+
| Strategy | Description |
258+
| --- | --- |
259+
| `stale-if-slow` | If [refresh keys][ref-refresh-keys] are up-to-date, returns cached value. If expired, tries to return fresh value from the data source. If the data source query is slow (hits [`Continue wait`](#continue-wait)), returns stale value from cache. |
260+
| `stale-while-revalidate`| If [refresh keys][ref-refresh-keys] are up-to-date, returns cached value. If expired, returns stale data from cache and updates cache in background. |
261+
| `must-revalidate` | If [refresh keys][ref-refresh-keys] are up-to-date, returns cached value. If expired, always waits for fresh value from the data source, even if slow (hits one or more [`Continue wait`](#continue-wait) intervals). |
262+
| `no-cache` | Skips [refresh key][ref-refresh-keys] checks. Always returns fresh data from the data source, regardless of cache or query performance. |
263+
264+
## `Continue wait`
254265

255266
If the request takes too long to be processed, the REST API responds with
256267
`{ "error": "Continue wait" }` and the status code 200.
@@ -295,6 +306,7 @@ warehouse][ref-data-warehouses].
295306
[ref-ref-load]: /product/apis-integrations/rest-api/reference#base_pathv1load
296307
[ref-ref-meta]: /product/apis-integrations/rest-api/reference#base_pathv1meta
297308
[ref-ref-sql]: /product/apis-integrations/rest-api/reference#base_pathv1sql
309+
[ref-ref-cubesql]: /product/apis-integrations/rest-api/reference#base_pathv1cubesql
298310
[ref-ref-paj]: /product/apis-integrations/rest-api/reference#base_pathv1pre-aggregationsjobs
299311
[ref-security-context]: /product/auth/context
300312
[ref-graphql-api]: /product/apis-integrations/graphql-api
@@ -313,4 +325,5 @@ warehouse][ref-data-warehouses].
313325
[ref-traditional-databases]: /product/configuration/data-sources#transactional-databases
314326
[ref-pre-aggregations]: /product/caching/using-pre-aggregations
315327
[ref-javascript-sdk]: /product/apis-integrations/javascript-sdk
316-
[ref-recipe-real-time-data-fetch]: /product/apis-integrations/recipes/real-time-data-fetch
328+
[ref-recipe-real-time-data-fetch]: /product/apis-integrations/recipes/real-time-data-fetch
329+
[ref-refresh-keys]: /product/data-modeling/reference/cube#refresh_key

docs/pages/product/apis-integrations/rest-api/query-format.mdx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,6 @@ The default value is `false`.
4141
- `timezone`: A [time zone][ref-time-zone] for your query. You can set the
4242
desired time zone in the [TZ Database Name](https://en.wikipedia.org/wiki/Tz_database)
4343
format, e.g., `America/Los_Angeles`.
44-
- `renewQuery`: If `renewQuery` is set to `true`, Cube will renew all
45-
[`refreshKey`][ref-schema-ref-preaggs-refreshkey] for queries and query
46-
results in the foreground. However, if the
47-
[`refreshKey`][ref-schema-ref-preaggs-refreshkey] (or
48-
[`refreshKey.every`][ref-schema-ref-preaggs-refreshkey-every]) doesn't
49-
indicate that there's a need for an update this setting has no effect. The
50-
default value is `false`.
51-
> **NOTE**: Cube provides only eventual consistency guarantee. Using a small
52-
> [`refreshKey.every`][ref-schema-ref-preaggs-refreshkey-every] value together
53-
> with `renewQuery` to achieve immediate consistency can lead to endless
54-
> refresh loops and overall system instability.
5544
- `ungrouped`: If set to `true`, Cube will run an [ungrouped
5645
query][ref-ungrouped-query].
5746
- `joinHints`: Query-time [join hints][ref-join-hints], provided as an array of

docs/pages/product/apis-integrations/rest-api/reference.mdx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ By default, it's `/cubejs-api`.
1313

1414
Run the query to the REST API and get the results.
1515

16-
| Parameter | Description |
17-
| ----------- | --------------------------------------------------------------------------------------------------------------------- |
18-
| `query` | Either a single URL encoded Cube [Query](/product/apis-integrations/rest-api/query-format), or an array of queries |
19-
| `queryType` | If multiple queries are passed in `query` for [data blending][ref-recipes-data-blending], this must be set to `multi` |
16+
| Parameter | Description | Required |
17+
| ----------- | --------------------------------------------------------------------------------------------------------------------- | --- |
18+
| `query` | Either a single URL encoded Cube [Query](/product/apis-integrations/rest-api/query-format), or an array of queries | ✅ Yes |
19+
| `queryType` | If multiple queries are passed in `query` for [data blending][ref-recipes-data-blending], this must be set to `multi` | ❌ No |
20+
| `cache` | See [cache control][ref-cache-control]. `stale-if-slow` by default | ❌ No |
2021

2122
Response
2223

@@ -319,9 +320,10 @@ This endpoint is part of the [SQL API][ref-sql-api].
319320

320321
</InfoBox>
321322

322-
| Parameter | Description |
323-
| --- | --- |
324-
| `query` | The SQL query to run. |
323+
| Parameter | Description | Required |
324+
| --- | --- | --- |
325+
| `query` | The SQL query to run. | ✅ Yes |
326+
| `cache` | See [cache control][ref-cache-control]. `stale-if-slow` by default | ❌ No |
325327

326328
Response: a stream of newline-delimited JSON objects. The first object contains
327329
the `schema` property with column names and types. The following objects contain
@@ -639,4 +641,5 @@ Keep-Alive: timeout=5
639641
[ref-query-wpd]: /product/apis-integrations/queries#query-with-pushdown
640642
[ref-sql-api]: /product/apis-integrations/sql-api
641643
[ref-orchestration-api]: /product/apis-integrations/orchestration-api
642-
[ref-folders]: /product/data-modeling/reference/view#folders
644+
[ref-folders]: /product/data-modeling/reference/view#folders
645+
[ref-cache-control]: /product/apis-integrations/rest-api#cache-control

0 commit comments

Comments
 (0)