Skip to main content
POST
/
v2
/
query
/
crosstab
v2 Crosstab Bulk Query
curl --request POST \
  --url https://api.globalwebindex.com/v2/query/crosstab \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "columns": [
    {
      "id": "134",
      "name": "my_audience",
      "expression": {
        "and": [
          {
            "question": "q2",
            "datapoints": [
              "q2_1",
              "q2_2"
            ],
            "min_count": 1,
            "not": false
          },
          {
            "question": "q6",
            "datapoints": [
              "q6_2"
            ],
            "min_count": 1,
            "not": false
          }
        ]
      }
    }
  ],
  "rows": [
    {
      "id": "133",
      "name": "my_audience",
      "expression": {
        "and": [
          {
            "question": "q2",
            "datapoints": [
              "q2_1",
              "q2_2"
            ],
            "min_count": 1,
            "not": false
          },
          {
            "question": "q6",
            "datapoints": [
              "q6_2"
            ],
            "min_count": 1,
            "not": false
          }
        ]
      }
    }
  ],
  "locations": [
    "s2_1",
    "s2_44"
  ],
  "waves": [
    "q1_2019",
    "q2_2019",
    "q3_2019",
    "q4_2019"
  ],
  "base_audience": {
    "id": "135",
    "name": "my_audience",
    "expression": {
      "and": [
        {
          "question": "q2",
          "datapoints": [
            "q2_1",
            "q2_2"
          ],
          "min_count": 1,
          "not": false
        },
        {
          "question": "q6",
          "datapoints": [
            "q6_2"
          ],
          "min_count": 1,
          "not": false
        }
      ]
    }
  }
}'
{
  "row": {
    "id": "133",
    "name": "my_audience",
    "expression": {
      "and": [
        {
          "question": "q2",
          "datapoints": [
            "q2_1",
            "q2_2"
          ],
          "min_count": 1,
          "not": false
        },
        {
          "question": "q6",
          "datapoints": [
            "q6_2"
          ],
          "min_count": 1,
          "not": false
        }
      ]
    }
  },
  "row_index": 123,
  "column": {
    "id": "134",
    "name": "my_audience",
    "expression": {
      "and": [
        {
          "question": "q2",
          "datapoints": [
            "q2_1",
            "q2_2"
          ],
          "min_count": 1,
          "not": false
        },
        {
          "question": "q6",
          "datapoints": [
            "q6_2"
          ],
          "min_count": 1,
          "not": false
        }
      ]
    }
  },
  "column_index": 123,
  "audiences": {
    "row": {
      "audience": "<string>",
      "size": 123,
      "sample": 123,
      "percentage": 123,
      "intersect_percentage": 123
    },
    "column": {
      "audience": "<string>",
      "size": 123,
      "sample": 123,
      "percentage": 123,
      "intersect_percentage": 123
    }
  },
  "base": {
    "size": 123,
    "sample": 123
  },
  "intersect": {
    "size": 123,
    "sample": 123,
    "percentage": 123,
    "index": 123
  }
}

Authorizations

Authorization
string
header
required

Body

application/json

Crosstab query.

Audiences and filters as parameters for Crosstab Builder metrics.

columns
Audience · object[]

Object of row and column audiences to make intersection from. If only one audience is queried then the base audience is taken as the second audience. If no audience is queried then base audience is taken for both row and column audiences.

rows
Audience · object[]

Object of row and column audiences to make intersection from. If only one audience is queried then the base audience is taken as the second audience. If no audience is queried then base audience is taken for both row and column audiences.

locations
string[]

List of location codes to filter.

Example:
["s2_1", "s2_44"]
waves
string[]

List of wave codes to filter. If not set or empty, will default to last 4 accessible waves. This differs from other endpoints where the default is all accessible waves because of performance reasons.

Example:
["q1_2019", "q2_2019", "q3_2019", "q4_2019"]
base_audience
object

Wrapper structure containing AudienceExpression.

Response

Unordered stream of query responses as json objects.

Result for an intersection of row and column audiences identified by its index starting from 0.

audiences
object
required
base
object
required

Metrics of base audience used for intersection

intersect
object
required

Metrics of intersection of queried audiences.

row
object

Wrapper structure containing AudienceExpression.

row_index
number

Index to specific row audience defined by the request. If the value is equal to 0, then the audience used was "All base respondents".

column
object

Wrapper structure containing AudienceExpression.

column_index
number

Index to specific column audience defined by the request. If the value is equal to 0, then the audience used was "All base respondents".

I