curl --request PATCH \
--url https://api.globalwebindex.com/v2/saved/audiences/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"datasets": [
"ds-core",
"ds-96c906f1"
],
"expression": {
"and": "<array>",
"datapoints": [
"q2_1"
],
"min_count": 123,
"not": false,
"options": [
"<string>"
],
"or": "<array>",
"question": "q2",
"suffixes": [
1
]
},
"flags": [
"authored",
"curated"
],
"folder": 123,
"folder_id": "b140035b-3adc-43bf-a39d-8e8005c8af2a",
"name": "Male with credit card and short-term loan",
"position": 128,
"shared": false
}
'import requests
url = "https://api.globalwebindex.com/v2/saved/audiences/{id}"
payload = {
"datasets": ["ds-core", "ds-96c906f1"],
"expression": {
"and": "<array>",
"datapoints": ["q2_1"],
"min_count": 123,
"not": False,
"options": ["<string>"],
"or": "<array>",
"question": "q2",
"suffixes": [1]
},
"flags": ["authored", "curated"],
"folder": 123,
"folder_id": "b140035b-3adc-43bf-a39d-8e8005c8af2a",
"name": "Male with credit card and short-term loan",
"position": 128,
"shared": False
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
datasets: ['ds-core', 'ds-96c906f1'],
expression: {
and: '<array>',
datapoints: ['q2_1'],
min_count: 123,
not: false,
options: ['<string>'],
or: '<array>',
question: 'q2',
suffixes: [1]
},
flags: ['authored', 'curated'],
folder: 123,
folder_id: 'b140035b-3adc-43bf-a39d-8e8005c8af2a',
name: 'Male with credit card and short-term loan',
position: 128,
shared: false
})
};
fetch('https://api.globalwebindex.com/v2/saved/audiences/{id}', 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/saved/audiences/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'datasets' => [
'ds-core',
'ds-96c906f1'
],
'expression' => [
'and' => '<array>',
'datapoints' => [
'q2_1'
],
'min_count' => 123,
'not' => false,
'options' => [
'<string>'
],
'or' => '<array>',
'question' => 'q2',
'suffixes' => [
1
]
],
'flags' => [
'authored',
'curated'
],
'folder' => 123,
'folder_id' => 'b140035b-3adc-43bf-a39d-8e8005c8af2a',
'name' => 'Male with credit card and short-term loan',
'position' => 128,
'shared' => false
]),
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/saved/audiences/{id}"
payload := strings.NewReader("{\n \"datasets\": [\n \"ds-core\",\n \"ds-96c906f1\"\n ],\n \"expression\": {\n \"and\": \"<array>\",\n \"datapoints\": [\n \"q2_1\"\n ],\n \"min_count\": 123,\n \"not\": false,\n \"options\": [\n \"<string>\"\n ],\n \"or\": \"<array>\",\n \"question\": \"q2\",\n \"suffixes\": [\n 1\n ]\n },\n \"flags\": [\n \"authored\",\n \"curated\"\n ],\n \"folder\": 123,\n \"folder_id\": \"b140035b-3adc-43bf-a39d-8e8005c8af2a\",\n \"name\": \"Male with credit card and short-term loan\",\n \"position\": 128,\n \"shared\": false\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.globalwebindex.com/v2/saved/audiences/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"datasets\": [\n \"ds-core\",\n \"ds-96c906f1\"\n ],\n \"expression\": {\n \"and\": \"<array>\",\n \"datapoints\": [\n \"q2_1\"\n ],\n \"min_count\": 123,\n \"not\": false,\n \"options\": [\n \"<string>\"\n ],\n \"or\": \"<array>\",\n \"question\": \"q2\",\n \"suffixes\": [\n 1\n ]\n },\n \"flags\": [\n \"authored\",\n \"curated\"\n ],\n \"folder\": 123,\n \"folder_id\": \"b140035b-3adc-43bf-a39d-8e8005c8af2a\",\n \"name\": \"Male with credit card and short-term loan\",\n \"position\": 128,\n \"shared\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.globalwebindex.com/v2/saved/audiences/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"datasets\": [\n \"ds-core\",\n \"ds-96c906f1\"\n ],\n \"expression\": {\n \"and\": \"<array>\",\n \"datapoints\": [\n \"q2_1\"\n ],\n \"min_count\": 123,\n \"not\": false,\n \"options\": [\n \"<string>\"\n ],\n \"or\": \"<array>\",\n \"question\": \"q2\",\n \"suffixes\": [\n 1\n ]\n },\n \"flags\": [\n \"authored\",\n \"curated\"\n ],\n \"folder\": 123,\n \"folder_id\": \"b140035b-3adc-43bf-a39d-8e8005c8af2a\",\n \"name\": \"Male with credit card and short-term loan\",\n \"position\": 128,\n \"shared\": false\n}"
response = http.request(request)
puts response.read_body{
"created_at": "<string>",
"datasets": [
"ds-core",
"ds-96c906f1"
],
"description": "Male millennials aged 18-24 who use social media daily",
"expression": {
"and": "<array>",
"datapoints": [
"q2_1"
],
"min_count": 123,
"not": false,
"options": [
"<string>"
],
"or": "<array>",
"question": "q2",
"suffixes": [
1
]
},
"flags": [
"authored"
],
"folder_id": "b140035b-3adc-43bf-a39d-8e8005c8af2a",
"id": "b140035b-3adc-43bf-a39d-8e8005c8af2a",
"name": "Male with credit card and short-term loan",
"permissions": {
"meta": {}
},
"position": 128,
"shared": false,
"sharings": {},
"updated_at": "<string>",
"user_id": 12345,
"v1_id": 12345
}"<string>""<string>""<string>""<string>"v2 Update Audience
Update only some attribute(s) of existing audience (partial update).
curl --request PATCH \
--url https://api.globalwebindex.com/v2/saved/audiences/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"datasets": [
"ds-core",
"ds-96c906f1"
],
"expression": {
"and": "<array>",
"datapoints": [
"q2_1"
],
"min_count": 123,
"not": false,
"options": [
"<string>"
],
"or": "<array>",
"question": "q2",
"suffixes": [
1
]
},
"flags": [
"authored",
"curated"
],
"folder": 123,
"folder_id": "b140035b-3adc-43bf-a39d-8e8005c8af2a",
"name": "Male with credit card and short-term loan",
"position": 128,
"shared": false
}
'import requests
url = "https://api.globalwebindex.com/v2/saved/audiences/{id}"
payload = {
"datasets": ["ds-core", "ds-96c906f1"],
"expression": {
"and": "<array>",
"datapoints": ["q2_1"],
"min_count": 123,
"not": False,
"options": ["<string>"],
"or": "<array>",
"question": "q2",
"suffixes": [1]
},
"flags": ["authored", "curated"],
"folder": 123,
"folder_id": "b140035b-3adc-43bf-a39d-8e8005c8af2a",
"name": "Male with credit card and short-term loan",
"position": 128,
"shared": False
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
datasets: ['ds-core', 'ds-96c906f1'],
expression: {
and: '<array>',
datapoints: ['q2_1'],
min_count: 123,
not: false,
options: ['<string>'],
or: '<array>',
question: 'q2',
suffixes: [1]
},
flags: ['authored', 'curated'],
folder: 123,
folder_id: 'b140035b-3adc-43bf-a39d-8e8005c8af2a',
name: 'Male with credit card and short-term loan',
position: 128,
shared: false
})
};
fetch('https://api.globalwebindex.com/v2/saved/audiences/{id}', 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/saved/audiences/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'datasets' => [
'ds-core',
'ds-96c906f1'
],
'expression' => [
'and' => '<array>',
'datapoints' => [
'q2_1'
],
'min_count' => 123,
'not' => false,
'options' => [
'<string>'
],
'or' => '<array>',
'question' => 'q2',
'suffixes' => [
1
]
],
'flags' => [
'authored',
'curated'
],
'folder' => 123,
'folder_id' => 'b140035b-3adc-43bf-a39d-8e8005c8af2a',
'name' => 'Male with credit card and short-term loan',
'position' => 128,
'shared' => false
]),
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/saved/audiences/{id}"
payload := strings.NewReader("{\n \"datasets\": [\n \"ds-core\",\n \"ds-96c906f1\"\n ],\n \"expression\": {\n \"and\": \"<array>\",\n \"datapoints\": [\n \"q2_1\"\n ],\n \"min_count\": 123,\n \"not\": false,\n \"options\": [\n \"<string>\"\n ],\n \"or\": \"<array>\",\n \"question\": \"q2\",\n \"suffixes\": [\n 1\n ]\n },\n \"flags\": [\n \"authored\",\n \"curated\"\n ],\n \"folder\": 123,\n \"folder_id\": \"b140035b-3adc-43bf-a39d-8e8005c8af2a\",\n \"name\": \"Male with credit card and short-term loan\",\n \"position\": 128,\n \"shared\": false\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.globalwebindex.com/v2/saved/audiences/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"datasets\": [\n \"ds-core\",\n \"ds-96c906f1\"\n ],\n \"expression\": {\n \"and\": \"<array>\",\n \"datapoints\": [\n \"q2_1\"\n ],\n \"min_count\": 123,\n \"not\": false,\n \"options\": [\n \"<string>\"\n ],\n \"or\": \"<array>\",\n \"question\": \"q2\",\n \"suffixes\": [\n 1\n ]\n },\n \"flags\": [\n \"authored\",\n \"curated\"\n ],\n \"folder\": 123,\n \"folder_id\": \"b140035b-3adc-43bf-a39d-8e8005c8af2a\",\n \"name\": \"Male with credit card and short-term loan\",\n \"position\": 128,\n \"shared\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.globalwebindex.com/v2/saved/audiences/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"datasets\": [\n \"ds-core\",\n \"ds-96c906f1\"\n ],\n \"expression\": {\n \"and\": \"<array>\",\n \"datapoints\": [\n \"q2_1\"\n ],\n \"min_count\": 123,\n \"not\": false,\n \"options\": [\n \"<string>\"\n ],\n \"or\": \"<array>\",\n \"question\": \"q2\",\n \"suffixes\": [\n 1\n ]\n },\n \"flags\": [\n \"authored\",\n \"curated\"\n ],\n \"folder\": 123,\n \"folder_id\": \"b140035b-3adc-43bf-a39d-8e8005c8af2a\",\n \"name\": \"Male with credit card and short-term loan\",\n \"position\": 128,\n \"shared\": false\n}"
response = http.request(request)
puts response.read_body{
"created_at": "<string>",
"datasets": [
"ds-core",
"ds-96c906f1"
],
"description": "Male millennials aged 18-24 who use social media daily",
"expression": {
"and": "<array>",
"datapoints": [
"q2_1"
],
"min_count": 123,
"not": false,
"options": [
"<string>"
],
"or": "<array>",
"question": "q2",
"suffixes": [
1
]
},
"flags": [
"authored"
],
"folder_id": "b140035b-3adc-43bf-a39d-8e8005c8af2a",
"id": "b140035b-3adc-43bf-a39d-8e8005c8af2a",
"name": "Male with credit card and short-term loan",
"permissions": {
"meta": {}
},
"position": 128,
"shared": false,
"sharings": {},
"updated_at": "<string>",
"user_id": 12345,
"v1_id": 12345
}"<string>""<string>""<string>""<string>"Authorizations
Path Parameters
Audience id
Body
Audience body
Dataset codes
["ds-core", "ds-96c906f1"]
Defines the audience criteria using question and datapoint combinations
Show child attributes
Show child attributes
Additional flags about audience (authored, curated, isP2)
["authored", "curated"]
V1 folder ID (legacy, use folder_id for v2)
Null/nil uuid or folder uuid
"b140035b-3adc-43bf-a39d-8e8005c8af2a"
Human readable name
"Male with credit card and short-term loan"
Position to give to be able to sort
128
Whether the audience is shared
false
Response
OK
The dataset codes used in the audience
["ds-core", "ds-96c906f1"]
The generated description of the audience
"Male millennials aged 18-24 who use social media daily"
The expression defining the audience criteria
Show child attributes
Show child attributes
The flags associated with the audience
["authored"]
The folder ID containing the audience
"b140035b-3adc-43bf-a39d-8e8005c8af2a"
The v2 UUID identifier of the audience
"b140035b-3adc-43bf-a39d-8e8005c8af2a"
The name of the audience
"Male with credit card and short-term loan"
The permissions for the audience
Show child attributes
Show child attributes
The position for sorting
128
Whether the audience is shared
false
The sharing information for the audience
Show child attributes
Show child attributes
The user ID who owns the audience
12345
The v1 ID of the audience
12345
Was this page helpful?

