Contents
On this page
Switch Profile - Plugixa Stream
POST /plugixa-stream/v1/me/profiles/{id}/switch
Put this login session on a profile. Other devices keep their own.
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. From a kids profile, switching to another kids profile is free; switching to an adult profile needs the PIN when one is set.
Note. Requests signed with an Application Password have no login session, so they always act as the account’s own profile. For them, switching changes nothing.
Request
POST https://your-site.example/wp-json/plugixa-stream/v1/me/profiles/0/switch
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The profile, 0 to 9 |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
pin |
string |
No | The 4-digit PIN, when leaving a kids profile for an adult one and a PIN is set. |
{
"pin": "4821"
}
Responses
200 OK. data is every profile, with the new active.
{
"success": true,
"data": {
"profiles": [
{
"id": 0,
"name": "Maya",
"avatar": 0,
"kids": false,
"main": true
},
{
"id": 1,
"name": "Leo",
"avatar": 3,
"kids": true,
"main": false
}
],
"active": 0,
"kids": false,
"has_pin": true,
"max": 5,
"can_add": true,
"avatars": 8
}
}
Errors
| Status | Code | When |
|---|---|---|
401 |
plugixa_stream_login_required |
Signed out. |
404 |
plugixa_stream_not_found |
No such profile. |
403 |
plugixa_stream_pin_wrong |
Wrong PIN. |
429 |
plugixa_stream_pin_locked |
5 wrong PINs: wait 15 minutes. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-stream/v1/me/profiles/0/switch" \
-u "$WP_USER:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"pin":"4821"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-stream/v1/me/profiles/0/switch');
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([
'pin' => '4821',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-stream/v1/me/profiles/0/switch', {
method: 'POST',
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ pin: '4821' }),
});
const { data } = await response.json();
Quick Links
Share