Skip to content

Query data in stream format

Returns requested dimensions and metrics as either JSON array or CSV table. Entire flat data set returned by request is always fetched as a streamed http response which client should store in one go. Streamed requests are ideal for fetching large base data sets quickly but they have certain limitations including no support for things like custom result set sorting, secondary aggregation or grouped series.

Query data as JSON stream

Request

POST https://api.zoined.com/v2/query/stream

Retrieve stream data in JSON format (flat array with one element per group).

Security
bearerAuth
Bodyapplication/json
contextobject

Context for the queries

Example:
{ "locale": "en", "currency": "EUR" }
queryobject

Query parameters

Example:
{ "grouping": [ "day", "store" ], "metrics": [ "sales", "sales_margin" ], "filters": {}, "seriesType": "actual", "sort": [ "day" ], "limit": 1000, "offset": 0, "label": "forecast", "fillTimeSeries": true }
curl -i -X POST \
  https://zapi-api.zoined.com/_mock/v2/query/stream \
  -H 'Authorization: Bearer <YOUR_token_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "context": {
      "locale": "en",
      "currency": "EUR"
    },
    "query": {
      "grouping": [
        "day",
        "store"
      ],
      "metrics": [
        "sales",
        "sales_margin"
      ],
      "filters": {},
      "seriesType": "actual",
      "sort": [
        "day"
      ],
      "limit": 1000,
      "offset": 0,
      "label": "forecast",
      "fillTimeSeries": true
    }
  }'

Responses

Request has been processed successfully.

Headers

  • Content-Type: application/json
Bodyapplication/json
Array [
dimensionsobject

All dimensions from grouping list

metricsobject

Aggregated metric values for set of dimensions

sortobject

List of items (dimension and metrics from above) to be used for sorting

]
Response
[ { "dimensions": { … }, "metrics": { … }, "sort": { … } } ]