Skip to main content
POST
/
v2
/
query
/
audience_wave_counts
v2 Audience Wave Counts Query
curl --request POST \
  --url https://api.globalwebindex.com/v2/query/audience_wave_counts \
  --header 'Content-Type: application/json' \
  --data '
{
  "and": [
    {
      "question": "q2",
      "options": [
        "q2_1",
        "q2_2"
      ],
      "min_count": 1,
      "not": false
    },
    {
      "question": "q6",
      "options": [
        "q6_2"
      ],
      "min_count": 1,
      "not": false
    }
  ]
}
'
import requests

url = "https://api.globalwebindex.com/v2/query/audience_wave_counts"

payload = { "and": [
{
"question": "q2",
"options": ["q2_1", "q2_2"],
"min_count": 1,
"not": False
},
{
"question": "q6",
"options": ["q6_2"],
"min_count": 1,
"not": False
}
] }
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
and: [
{question: 'q2', options: ['q2_1', 'q2_2'], min_count: 1, not: false},
{question: 'q6', options: ['q6_2'], min_count: 1, not: false}
]
})
};

fetch('https://api.globalwebindex.com/v2/query/audience_wave_counts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.globalwebindex.com/v2/query/audience_wave_counts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'and' => [
[
'question' => 'q2',
'options' => [
'q2_1',
'q2_2'
],
'min_count' => 1,
'not' => false
],
[
'question' => 'q6',
'options' => [
'q6_2'
],
'min_count' => 1,
'not' => false
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.globalwebindex.com/v2/query/audience_wave_counts"

payload := strings.NewReader("{\n \"and\": [\n {\n \"question\": \"q2\",\n \"options\": [\n \"q2_1\",\n \"q2_2\"\n ],\n \"min_count\": 1,\n \"not\": false\n },\n {\n \"question\": \"q6\",\n \"options\": [\n \"q6_2\"\n ],\n \"min_count\": 1,\n \"not\": false\n }\n ]\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.globalwebindex.com/v2/query/audience_wave_counts")
.header("Content-Type", "application/json")
.body("{\n \"and\": [\n {\n \"question\": \"q2\",\n \"options\": [\n \"q2_1\",\n \"q2_2\"\n ],\n \"min_count\": 1,\n \"not\": false\n },\n {\n \"question\": \"q6\",\n \"options\": [\n \"q6_2\"\n ],\n \"min_count\": 1,\n \"not\": false\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.globalwebindex.com/v2/query/audience_wave_counts")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"and\": [\n {\n \"question\": \"q2\",\n \"options\": [\n \"q2_1\",\n \"q2_2\"\n ],\n \"min_count\": 1,\n \"not\": false\n },\n {\n \"question\": \"q6\",\n \"options\": [\n \"q6_2\"\n ],\n \"min_count\": 1,\n \"not\": false\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "data": [
    {
      "wave_code": "q2_2019",
      "total": 10,
      "percentage": 0.3
    }
  ]
}

Body

application/json

Audience Expression

Flexible expression of audience scope.

and
array

List of sub-expressions to apply intersection of their scopes.

or
array

List of sub-expressions to apply union of their scopes.

not
boolean

To use negation of the expression.

question
string

Question code to define datapoint scope.

Example:

"q2"

options
string[]

Datapoint codes to limit scopes of interest.

Example:
["q2_1", "q2_2"]
suffixes
string[]

Suffixes to extend datapoint codes for more detailed responses.

Example:
["1", "2", "3"]
min_count
integer

Minimal count of positive datapoints in one response.

Example:

1

Response

Correct results for given expression.

Result of wave counts for audience builder query

data
WaveCountsResult · object[]