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
|
||
| Status | New | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2025-09-12 10:09:07 |
| Closed_By | ⇒ | alikon |
| Status | Closed | ⇒ | New |
| Closed_Date | 2025-09-12 10:09:07 | ⇒ | |
| Closed_By | alikon | ⇒ |
Re-opening as we had to revert the pull request. Details will follow later today or tomorrow.
Unfortunately we had to revert PR #46080 yesterday because we were building the 5.4.3-rc1 and 6.0.3-rc1 and we had found a small issue in the PR after it was merged which we have missed before:
filter="intarray" for the "rules" field in the form is not right."rules": [1,2] instead of "rules": "[1,2]" in the examples in this issue's description.required="true" of the "id" field is fine.@alikon We would be happy if you could redo your PR but without the removal of the filter="intarray" for the "rules" field (and with the system tests possibly adapted to that.
Sorry for the inconvenience, and thanks for your contribution, and thanks in advance for the new PR.
This is now becoming urgent.
Does anyone have any idea where the source of this error might be in the api code?
I am keen to remedy fully, but would be happy to manually patch the one system i have that i need this api function to work.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45971.