Error when deactivating a user via the API

Can you try without the active and changed data (you cannot alter active, and changed doesn’t exist), and format the date stopping at the second (e.g. 2024-02-23T16:38:04 not 2024-02-23T16:38:04+00:00). e.g.

$currentDateTime = date('Y-m-d\TH:i:s');
$data = [
  'disabled' => $currentDateTime,
];

Edit: I just tried it should work

<?php
$currentDateTime = date('Y-m-d\TH:i:s');
$data = [
    'disabled' => $currentDateTime
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'X-CSRF-Token: ' . $csrfToken,
    'Accept: application/json',
    'Content-Type: application/json',
    'Cookie: ' . $cookies
));
$response = curl_exec($ch);
curl_close($ch);
1 Like