using the api endpoint /api/index.php/v1/users/levels by postman or php to create an access view level results in an error message
{"errors":[{"title":"Field required: id"}]}
sample php curl (substitute your own website and api token)
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_CAINFO=>$mypemfileloc,
CURLOPT_URL => 'https://mysite.com/api/index.php/v1/users/levels',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{"id":"0",
"title": "aaTechnician",
"rules": "[1,2]",
"attributes":{
"id":"0",
"title": "aaTechnician",
"rules": "[1,2]"}}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'X-Joomla-Token: '.$token
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
have attempted different variations of
CURLOPT_POSTFIELDS => '{"id":"0",
"title": "aaTechnician",
"rules": "[1,2]",
"attributes":{
"id":"0",
"title": "aaTechnician",
"rules": "[1,2]"}}',
or
CURLOPT_POSTFIELDS => '{"id":"0",
"title": "aaTechnician",
"rules": "[1,2]"}',
or
CURLOPT_POSTFIELDS => '{
"title": "aaTechnician",
"rules": "[1,2]"}',
All give the same error
Other endpoints work as expected.
Switching on full logging in Joomla gives a little more information (ip address removed)
#
#Date: 2025-08-24 07:53:29 UTC
#Software: Joomla! 5.3.3 Stable [ Timu ] 19-August-2025 16:00 GMT
#Fields: datetime priority clientip category message
2025-08-24T07:53:29+00:00 CRITICAL xxx.xxx.xxx.xxx error Uncaught Throwable of type Tobscure\JsonApi\Exception\InvalidParameterException thrown with message "Field required: id".
Stack trace:
#0 [ROOT]/libraries/src/MVC/Controller/ApiController.php(327): Joomla\CMS\MVC\Controller\ApiController->save()
#1 [ROOT]/libraries/src/MVC/Controller/BaseController.php(730): Joomla\CMS\MVC\Controller\ApiController->add()
#2 [ROOT]/libraries/src/Dispatcher/ApiDispatcher.php(61): Joomla\CMS\MVC\Controller\BaseController->execute()
#3 [ROOT]/libraries/src/Component/ComponentHelper.php(361): Joomla\CMS\Dispatcher\ApiDispatcher->dispatch()
#4 [ROOT]/libraries/src/Application/ApiApplication.php(433): Joomla\CMS\Component\ComponentHelper::renderComponent()
#5 [ROOT]/libraries/src/Application/ApiApplication.php(116): Joomla\CMS\Application\ApiApplication->dispatch()
#6 [ROOT]/libraries/src/Application/CMSApplication.php(304): Joomla\CMS\Application\ApiApplication->doExecute()
#7 [ROOT]/api/includes/app.php(50): Joomla\CMS\Application\CMSApplication->execute()
#8 [ROOT]/api/index.php(31): require_once('...')
#9 {main}
Expected - successful response indicating creation of view level
error message
{"errors":[{"title":"Field required: id"}]}
and fails to create level
Joomla! 5.3.3 Stable [ Timu ] 19-August-2025 16:00 GMT
Database Version 10.11.14-MariaDB
PHP Version 8.2.29
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
Labels |
Added:
Webservices
|