Join or leave channels
const url = 'http://localhost:11044/api/v1/audience/channels';const options = { method: 'PUT', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>', 'Content-Type': 'application/json'}, body: '{"channels":["example"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url http://localhost:11044/api/v1/audience/channels \ --header 'Content-Type: application/json' \ --header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \ --data '{ "channels": [ "example" ] }'The whole set, not a delta — a client that sends what it displays cannot drift from it. Names are normalised, so what an author wrote and what a user picked are the same channel.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Every channel the user should be in afterwards. A channel left out is left; an empty list leaves them all.
Body of PUT /audience/channels: the complete set of channels the user should be in afterwards.
object
Every channel the user should be in afterwards, replacing the current set. Names are trimmed and lowercased, and blank ones dropped; empty or absent leaves every channel
Example generated
{ "channels": [ "example" ]}Responses
Section titled “Responses”OK
The audience channels this world offers and the ones the acting user has joined. Answered by GET /audience/channels and, after the change, by PUT /audience/channels.
object
The channels the acting user has joined, sorted by name; may include channels nothing currently declares
Every channel a view or app in this world declares, whether or not anybody has joined it, sorted by name. Empty when the world could not be loaded
One audience channel this world’s content declares, and how much content joining it would reach.
object
Number of apps in this world that declare the channel
Channel name, normalised to trimmed lowercase
Number of saved views in this world that declare the channel
Example generated
{ "joined": [ "example" ], "offered": [ { "apps": 1, "channel": "example", "views": 1 } ]}
