Contents
Screen Heartbeat - Plugixa Stream
POST /plugixa-stream/v1/me/screens/beat
The player’s heartbeat while it plays (about every 45 seconds), and its goodbye when it closes. The answer says whether this screen may go on playing.
Any signed-in user (an Application Password, or the login cookie with an X-WP-Nonce header). Signed out, it answers 401 plugixa_stream_login_required. It always acts on the caller’s own account. A screen is the login session, or the browser when there is none. Accounts with plugixa_stream_edit have no limit. Rate-limited with the other screen requests: 60 a minute per account.
Request
POST https://your-site.example/wp-json/plugixa-stream/v1/me/screens/beat
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
episode_id |
integer |
No | The episode playing. |
end |
boolean |
No | true when the player closes: frees the screen at once. |
{
"episode_id": 2816
}
Responses
200 OK.
{
"success": true,
"data": {
"play": false,
"offer": {
"kind": "screens",
"limit": 2,
"screens": [
{
"id": "3f9a1c07be52",
"label": "Chrome on Windows",
"watching": "Flash Gordon",
"seen": 12,
"current": false
}
]
}
}
}
| Field | Type | Meaning |
|---|---|---|
data.play |
boolean |
May keep playing. Always false after end |
data.offer |
object |
When it may not: kind (screens), the limit, and the other screens |
A screen another one took over is told once, then forgotten.
Errors
| Status | Code | When |
|---|---|---|
401 |
plugixa_stream_login_required |
Signed out. |
429 |
plugixa_stream_rate_limited |
More than 60 requests of this kind in the current minute. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-stream/v1/me/screens/beat" \
-u "$WP_USER:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"episode_id":2816}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-stream/v1/me/screens/beat');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'episode_id' => 2816,
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-stream/v1/me/screens/beat', {
method: 'POST',
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ episode_id: 2816 }),
});
const { data } = await response.json();
Quick Links
Share