You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: http/README.md
+76Lines changed: 76 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -184,6 +184,82 @@ FROM tvmaze
184
184
WHERE request_path = '/shows/82';
185
185
```
186
186
187
+
## Pagination
188
+
189
+
The HTTP connector supports automatic pagination for REST APIs that return data across multiple pages. This recipe includes a second dataset that demonstrates query-parameter pagination with the [DummyJSON Products API](https://dummyjson.com/docs/products).
190
+
191
+
### Configuration
192
+
193
+
The `products` dataset in `spicepod.yaml` uses query-parameter pagination:
- **`pagination: enabled`** — Turns on pagination.
208
+
- **`pagination_query_params`** — Template with `{offset}` and `{limit}` variables. Spice expands these automatically for each page (`skip=0&limit=30`, `skip=30&limit=30`, …).
209
+
- **`pagination_page_size`** — Number of items per page. Also determines when to stop: if a page returns fewer rows than this value, pagination is complete.
210
+
- **`pagination_max_pages`** — Safety limit on the number of pages to fetch.
211
+
212
+
### Querying Paginated Data
213
+
214
+
Count all products fetched across pages:
215
+
216
+
```sql
217
+
SELECT count(*) FROM products;
218
+
```
219
+
220
+
```console
221
+
+----------+
222
+
| count(*) |
223
+
+----------+
224
+
| 194 |
225
+
+----------+
226
+
```
227
+
228
+
All 194 products are returned transparently — Spice fetches 7 pages (30 items each, except the last page with 14) and combines them into a single result set.
229
+
230
+
Inspect products and observe how `request_query` changes as rows span pages:
The first 30 rows come from page 1 (`skip=0&limit=30`), then rows from page 2 (`skip=30&limit=30`) follow automatically.
260
+
261
+
For the full pagination parameter reference, see the [HTTP Data Connector documentation](https://docs.spiceai.org/components/data-connectors/https#pagination-parameters).
262
+
187
263
## Dynamic HTTP Connector Features
188
264
189
265
The HTTP connector provides powerful dynamic capabilities through special metadata fields that allow you to construct HTTP requests dynamically via SQL queries.
0 commit comments