Contents
On this page

Switch Events - Plugixa Activity Log

PATCH /plugixa-activity-log/v1/events/catalogue

Switch kinds of event on or off. This changes what is recorded from now on and rewrites no history. POST works the same way.

Needs settings access (who can call what).

Request

PATCH https://your-site.example/wp-json/plugixa-activity-log/v1/events/catalogue

Request body

Content type: application/json

Field Type Required Description
overrides object Yes Event code => true (on) or false (off). Only true, 1, "1" and "true" count as on; any other value means off.

Only the codes you send change; every other event keeps its state. Only differences from an event’s default are stored, so setting an event back to its default removes the override, and a later release that changes the default then applies. When something actually changes, it is recorded in the log as event 9000.

{
  "overrides": { "2001": false, "2012": true }
}

Note. Codes are checked one by one, in the order sent, and the first unknown or locked code stops the request: nothing is saved, including the codes before it. An empty or missing overrides saves nothing and answers 200.

Responses

200 OK. data is the whole catalogue after the change.

{
  "success": true,
  "data": [
    {
      "code": 2001,
      "group": "content",
      "group_label": "Posts and pages",
      "subgroup": "Life cycle",
      "severity": "low",
      "object_type": "post",
      "action": "published",
      "message": "{type} “{object}” was published.",
      "module": "content",
      "default_enabled": true,
      "enabled": false,
      "locked": false,
      "monitor_running": true
    }
  ]
}

The fields are as in Event Catalogue.

Errors

Status Code When
422 plugixa_activity_log_unknown_event A code in overrides is not a known event.
422 plugixa_activity_log_locked_event A code of 9000 or above is switched off: the log’s own record cannot be. Switching one on is accepted and changes nothing.

Plus the errors every endpoint can return.

Examples

curl -s -X PATCH "https://your-site.example/wp-json/plugixa-activity-log/v1/events/catalogue" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"overrides":{"2001":false,"2012":true}}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-activity-log/v1/events/catalogue');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'PATCH',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'overrides' => ['2001' => false, '2012' => true],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const auth = Buffer.from(`admin:${process.env.WP_APP_PASSWORD}`).toString('base64');
const response = await fetch('https://your-site.example/wp-json/plugixa-activity-log/v1/events/catalogue', {
  method: 'PATCH',
  headers: {
    'Authorization': `Basic ${auth}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ overrides: { 2001: false, 2012: true } }),
});
const { data } = await response.json();

Quick Links

Share