Resolve location and timeframe filters
curl --request POST \
--url https://api.globalwebindex.com/v2/spark-api/global-filters \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "UK in Q1 2025"
}
'import requests
url = "https://api.globalwebindex.com/v2/spark-api/global-filters"
payload = { "prompt": "UK in Q1 2025" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({prompt: 'UK in Q1 2025'})
};
fetch('https://api.globalwebindex.com/v2/spark-api/global-filters', 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/spark-api/global-filters",
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([
'prompt' => 'UK in Q1 2025'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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/spark-api/global-filters"
payload := strings.NewReader("{\n \"prompt\": \"UK in Q1 2025\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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/spark-api/global-filters")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"UK in Q1 2025\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.globalwebindex.com/v2/spark-api/global-filters")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"UK in Q1 2025\"\n}"
response = http.request(request)
puts response.read_body{
"global_filters": {
"location_names": [
"UK"
],
"location_codes": [
"s2_44"
],
"wave_names": [
"Q1 2025"
],
"wave_codes": [
"q1_2025"
]
}
}{
"type": "https://api.globalwebindex.com/docs/spark-api/problems/invalid-request",
"title": "Invalid request",
"status": 400,
"detail": "invalid JSON body: unexpected end of JSON input",
"instance": "/v2/spark-api/audiences/search"
}{
"message": "Unauthorized"
}{
"type": "https://api.globalwebindex.com/docs/spark-api/problems/access-denied",
"title": "Access denied",
"status": 403,
"detail": "dataset access denied",
"instance": "/v2/spark-api/global-filters"
}{
"message": "Request Entity Too Large"
}{
"type": "https://api.globalwebindex.com/docs/spark-api/problems/invalid-params",
"title": "Invalid parameters",
"status": 422,
"detail": "could not validate input: prompt should be a non empty string",
"instance": "/v2/spark-api/global-filters"
}{
"type": "https://api.globalwebindex.com/docs/spark-api/problems/internal",
"title": "Internal server error",
"status": 500,
"detail": "There was an error processing your request. Please try again later.",
"instance": "/v2/spark-api/insights/generate"
}{
"type": "https://api.globalwebindex.com/docs/spark-api/problems/timeout",
"title": "Request timeout",
"status": 504,
"detail": "service is taking longer than usual to respond: please try again in a few moments",
"instance": "/v2/spark-api/insights/generate"
}Filters
Resolve location and timeframe filters
Resolves the locations and timeframes named in a prompt into location and wave codes. Pass location_codes and wave_codes to POST /audiences/generate and POST /insights/generate.
POST
/
v2
/
spark-api
/
global-filters
Resolve location and timeframe filters
curl --request POST \
--url https://api.globalwebindex.com/v2/spark-api/global-filters \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "UK in Q1 2025"
}
'import requests
url = "https://api.globalwebindex.com/v2/spark-api/global-filters"
payload = { "prompt": "UK in Q1 2025" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({prompt: 'UK in Q1 2025'})
};
fetch('https://api.globalwebindex.com/v2/spark-api/global-filters', 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/spark-api/global-filters",
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([
'prompt' => 'UK in Q1 2025'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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/spark-api/global-filters"
payload := strings.NewReader("{\n \"prompt\": \"UK in Q1 2025\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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/spark-api/global-filters")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"UK in Q1 2025\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.globalwebindex.com/v2/spark-api/global-filters")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"UK in Q1 2025\"\n}"
response = http.request(request)
puts response.read_body{
"global_filters": {
"location_names": [
"UK"
],
"location_codes": [
"s2_44"
],
"wave_names": [
"Q1 2025"
],
"wave_codes": [
"q1_2025"
]
}
}{
"type": "https://api.globalwebindex.com/docs/spark-api/problems/invalid-request",
"title": "Invalid request",
"status": 400,
"detail": "invalid JSON body: unexpected end of JSON input",
"instance": "/v2/spark-api/audiences/search"
}{
"message": "Unauthorized"
}{
"type": "https://api.globalwebindex.com/docs/spark-api/problems/access-denied",
"title": "Access denied",
"status": 403,
"detail": "dataset access denied",
"instance": "/v2/spark-api/global-filters"
}{
"message": "Request Entity Too Large"
}{
"type": "https://api.globalwebindex.com/docs/spark-api/problems/invalid-params",
"title": "Invalid parameters",
"status": 422,
"detail": "could not validate input: prompt should be a non empty string",
"instance": "/v2/spark-api/global-filters"
}{
"type": "https://api.globalwebindex.com/docs/spark-api/problems/internal",
"title": "Internal server error",
"status": 500,
"detail": "There was an error processing your request. Please try again later.",
"instance": "/v2/spark-api/insights/generate"
}{
"type": "https://api.globalwebindex.com/docs/spark-api/problems/timeout",
"title": "Request timeout",
"status": 504,
"detail": "service is taking longer than usual to respond: please try again in a few moments",
"instance": "/v2/spark-api/insights/generate"
}Body
application/json
Was this page helpful?

