Contents
On this page

End Session - Plugixa Activity Log

DELETE /plugixa-activity-log/v1/sessions/{user_id}/{verifier}

End one session: that device is signed out, the user’s other sessions are left alone.

You may call it for your own sessions with any signed-in account; for anybody else’s you need settings access (see who can call what). Needs Plugixa Activity Log Pro, with the User sessions module on under Plugixa Activity Log -> Monitors.

Ending somebody else’s session is recorded in the log as event 9200, with the address the session used. Ending one of your own is not recorded.

Request

DELETE https://your-site.example/wp-json/plugixa-activity-log/v1/sessions/1/3f9a1c0e7b2d4a6f8e5c9b1d0a2f4e6c8b7a9d1e3f5c7b9a0d2e4f6a8c1b3d5e

Path parameters

Name Type Description
user_id integer The WordPress user id
verifier string The session’s verifier from List Sessions: 64 lowercase hexadecimal characters. Anything else does not match the route and answers 404 rest_no_route.

Responses

200 OK. The session is gone.

{
  "success": true,
  "data": { "ended": 1 }
}
Field Type Meaning
data.ended integer Always 1

Errors

Status Code When
404 plugixa_activity_log_session_not_found No user with that id, or that user has no session with this verifier (it ended or expired).

Plus the errors every endpoint can return.

Examples

curl -s -X DELETE "https://your-site.example/wp-json/plugixa-activity-log/v1/sessions/1/3f9a1c0e7b2d4a6f8e5c9b1d0a2f4e6c8b7a9d1e3f5c7b9a0d2e4f6a8c1b3d5e" \
  -u "admin:$WP_APP_PASSWORD"
<?php
$verifier = '3f9a1c0e7b2d4a6f8e5c9b1d0a2f4e6c8b7a9d1e3f5c7b9a0d2e4f6a8c1b3d5e';
$ch = curl_init('https://your-site.example/wp-json/plugixa-activity-log/v1/sessions/1/' . $verifier);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'DELETE',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const auth = Buffer.from(`admin:${process.env.WP_APP_PASSWORD}`).toString('base64');
const verifier = '3f9a1c0e7b2d4a6f8e5c9b1d0a2f4e6c8b7a9d1e3f5c7b9a0d2e4f6a8c1b3d5e';
const response = await fetch(`https://your-site.example/wp-json/plugixa-activity-log/v1/sessions/1/${verifier}`, {
  method: 'DELETE',
  headers: {
    'Authorization': `Basic ${auth}`,
  },
});
const { data } = await response.json();

Quick Links

Share