Skip to main content
POST
/
v3
/
query
/
audience_wave_counts
v3 Audience Wave Counts Query
curl --request POST \
  --url https://api.globalwebindex.com/v3/query/audience_wave_counts \
  --header 'Content-Type: application/json' \
  --data '
{
  "expression": {},
  "locations": [
    "s2_1",
    "s2_44"
  ],
  "waves": [
    "q1_2019",
    "q2_2019",
    "q3_2019",
    "q4_2019"
  ]
}
'
import requests

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

payload = {
"expression": {},
"locations": ["s2_1", "s2_44"],
"waves": ["q1_2019", "q2_2019", "q3_2019", "q4_2019"]
}
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({
expression: {},
locations: ['s2_1', 's2_44'],
waves: ['q1_2019', 'q2_2019', 'q3_2019', 'q4_2019']
})
};

fetch('https://api.globalwebindex.com/v3/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/v3/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([
'expression' => [

],
'locations' => [
's2_1',
's2_44'
],
'waves' => [
'q1_2019',
'q2_2019',
'q3_2019',
'q4_2019'
]
]),
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/v3/query/audience_wave_counts"

payload := strings.NewReader("{\n \"expression\": {},\n \"locations\": [\n \"s2_1\",\n \"s2_44\"\n ],\n \"waves\": [\n \"q1_2019\",\n \"q2_2019\",\n \"q3_2019\",\n \"q4_2019\"\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/v3/query/audience_wave_counts")
.header("Content-Type", "application/json")
.body("{\n \"expression\": {},\n \"locations\": [\n \"s2_1\",\n \"s2_44\"\n ],\n \"waves\": [\n \"q1_2019\",\n \"q2_2019\",\n \"q3_2019\",\n \"q4_2019\"\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.globalwebindex.com/v3/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 \"expression\": {},\n \"locations\": [\n \"s2_1\",\n \"s2_44\"\n ],\n \"waves\": [\n \"q1_2019\",\n \"q2_2019\",\n \"q3_2019\",\n \"q4_2019\"\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "base_size": 123,
  "base_sample": 123,
  "audience_sample": 123,
  "audience_size": 123,
  "audience_percentage": 123,
  "per_wave_count": [
    {
      "code": "q2_2019",
      "name": "Q2 2019",
      "sample": 10,
      "percentage": 0.3
    }
  ]
}
{
"error": "some_error",
"error_type": "empty_expression",
"code": 400,
"message": "Message readable by customer."
}
{
"error": "some_error",
"error_type": "empty_expression",
"code": 400,
"message": "Message readable by customer."
}
{
"error": "some_error",
"error_type": "empty_expression",
"code": 403,
"meta": {
"forbidden_codes": {
"questions": [
{
"code": "q2",
"datapoints": [
"q1_1"
],
"origin": "question"
}
],
"locations": [
"s2_44"
],
"waves": [
"q1_2019"
]
}
}
}

Body

application/json

Returns sample for waves.

Query containing audience expression.

expression
object
required

Audience expression used to get wave counts.

locations
string[]

List of location codes to filter.

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

List of wave codes to filter.

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

Response

Correct results for given expression.

base_size
integer

Final weighted universe of total audience.

base_sample
integer

Final count of responses of total audience.

audience_sample
integer

Final count of responses of the audience.

audience_size
integer

Final weighted universe of the audience.

audience_percentage
number

Ratio between audience size and base size.

per_wave_count
PerWaveResult · object[]

Collection of results for each wave.