Audiences
PUT /audiences/{audienceId}/rules
Replace all rules for an audience. Deletes existing rules and creates new ones.
PUT
/
audiences
/
{audienceId}
/
rules
cURL
curl --request PUT \
--url https://admin.fanfare.io/api/audiences/{audienceId}/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rules": [
{
"audienceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"field": "<string>",
"values": [
"<string>"
],
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"position": 123
}
]
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
rules: [
{
audienceId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
field: '<string>',
values: ['<string>'],
groupId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
position: 123
}
]
})
};
fetch('https://admin.fanfare.io/api/audiences/{audienceId}/rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://admin.fanfare.io/api/audiences/{audienceId}/rules"
payload = { "rules": [
{
"audienceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"field": "<string>",
"values": ["<string>"],
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"position": 123
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://admin.fanfare.io/api/audiences/{audienceId}/rules"
payload := strings.NewReader("{\n \"rules\": [\n {\n \"audienceId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"field\": \"<string>\",\n \"values\": [\n \"<string>\"\n ],\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"position\": 123\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}[
{
"audienceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"field": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"operator": "EQUALS",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"values": [
"<string>"
],
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"position": 0
}
]{
"error": "validation_error",
"issues": [
{
"expected": "<string>",
"kind": "<string>",
"message": "<string>",
"path": [
{
"input": "<unknown>",
"key": "<string>",
"origin": "<string>",
"type": "<string>"
}
],
"received": "<string>",
"type": "<string>"
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Fanfare secret key. Keep secret credentials on your server.
Path Parameters
Body
application/json
Show child attributes
Show child attributes
Response
Audience rules replaced successfully
Available options:
EQUALS, NOT_EQUALS, GREATER_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN, LESS_THAN_OR_EQUAL, BETWEEN, CONTAINS, NOT_CONTAINS, IN, NOT_IN, EXISTS, NOT_EXISTS ⌘I
cURL
curl --request PUT \
--url https://admin.fanfare.io/api/audiences/{audienceId}/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rules": [
{
"audienceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"field": "<string>",
"values": [
"<string>"
],
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"position": 123
}
]
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
rules: [
{
audienceId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
field: '<string>',
values: ['<string>'],
groupId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
position: 123
}
]
})
};
fetch('https://admin.fanfare.io/api/audiences/{audienceId}/rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://admin.fanfare.io/api/audiences/{audienceId}/rules"
payload = { "rules": [
{
"audienceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"field": "<string>",
"values": ["<string>"],
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"position": 123
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://admin.fanfare.io/api/audiences/{audienceId}/rules"
payload := strings.NewReader("{\n \"rules\": [\n {\n \"audienceId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"field\": \"<string>\",\n \"values\": [\n \"<string>\"\n ],\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"position\": 123\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}[
{
"audienceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"field": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"operator": "EQUALS",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"values": [
"<string>"
],
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"position": 0
}
]{
"error": "validation_error",
"issues": [
{
"expected": "<string>",
"kind": "<string>",
"message": "<string>",
"path": [
{
"input": "<unknown>",
"key": "<string>",
"origin": "<string>",
"type": "<string>"
}
],
"received": "<string>",
"type": "<string>"
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}