Replace your application's registered audiences
curl --request PUT \
--url https://api.baselayer.com/acceptance/audiences \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"audiences": [
"<string>"
]
}
'import requests
url = "https://api.baselayer.com/acceptance/audiences"
payload = { "audiences": ["<string>"] }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({audiences: ['<string>']})
};
fetch('https://api.baselayer.com/acceptance/audiences', 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.baselayer.com/acceptance/audiences",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'audiences' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.baselayer.com/acceptance/audiences"
payload := strings.NewReader("{\n \"audiences\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<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.put("https://api.baselayer.com/acceptance/audiences")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"audiences\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baselayer.com/acceptance/audiences")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"audiences\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"audiences": [
"<string>"
]
}{
"type": "resource_not_found",
"code": 1,
"message": "Could not locate the resource for the given URI.",
"metadata": {}
}{
"type": "audiences_stale",
"code": 7232,
"message": "The audiences have changed since the version you edited. Read them again and reapply your change.",
"metadata": {}
}{
"type": "validation_failed",
"code": 7112,
"message": "The request is invalid.",
"metadata": {}
}{
"type": "if_match_required",
"code": 7220,
"message": "A replace needs an If-Match header naming the version you edited.",
"metadata": {}
}Audiences
Replace your application's registered audiences
Stores the body’s audiences, sorted, in place of the current ones. Each must already be canonical: a bare lowercase domain or https://<host>. Send the ETag of the list you edited as If-Match; if another write changed it first, the replace is refused and nothing changes. The change applies to presentations checked after it.
PUT
/
acceptance
/
audiences
Replace your application's registered audiences
curl --request PUT \
--url https://api.baselayer.com/acceptance/audiences \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"audiences": [
"<string>"
]
}
'import requests
url = "https://api.baselayer.com/acceptance/audiences"
payload = { "audiences": ["<string>"] }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({audiences: ['<string>']})
};
fetch('https://api.baselayer.com/acceptance/audiences', 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.baselayer.com/acceptance/audiences",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'audiences' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.baselayer.com/acceptance/audiences"
payload := strings.NewReader("{\n \"audiences\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<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.put("https://api.baselayer.com/acceptance/audiences")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"audiences\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baselayer.com/acceptance/audiences")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"audiences\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"audiences": [
"<string>"
]
}{
"type": "resource_not_found",
"code": 1,
"message": "Could not locate the resource for the given URI.",
"metadata": {}
}{
"type": "audiences_stale",
"code": 7232,
"message": "The audiences have changed since the version you edited. Read them again and reapply your change.",
"metadata": {}
}{
"type": "validation_failed",
"code": 7112,
"message": "The request is invalid.",
"metadata": {}
}{
"type": "if_match_required",
"code": 7220,
"message": "A replace needs an If-Match header naming the version you edited.",
"metadata": {}
}Authorizations
Headers
The ETag of the list the body was edited from.
Body
application/jsonapplication/vnd.baselayer.v1+json
The audiences a replace stores, sorted, in place of the current ones.
Canonical audiences, each exactly as canonicalized: a bare lowercase domain or https://<host>. Stored and returned sorted.
Maximum array length:
50Maximum string length:
253Response
The stored audiences.
The audiences a key-binding JWT's aud must be one of.
The registered audiences, sorted ascending.