No Code Attached Yet ?
avatar xhorizont
xhorizont
10 Nov 2021

System information (as much as possible)

J4.0.3
PHP 8.0.11 (cli) (built: Sep 23 2021 21:26:24) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.11, Copyright (c) Zend Technologies
with Zend OPcache v8.0.11, Copyright (c), by Zend Technologies

Additional comments

Testing API in Postman and when I GET {{base_path}}/api/index.php/v1/content/articles/66 (it exists), I get response:

{
"errors": {
"code": 500,
"title": "Internal server error"
}

In apache2/error.log I get:
PHP Warning: Undefined property: Joomla\CMS\Table\Update::$targetplatform in /var/www/html/libraries/src/Updater/Adapter/ExtensionAdapter.php on line 112
PHP Warning: Trying to access array offset on value of type null in /var/www/html/libraries/src/Updater/Adapter/ExtensionAdapter.php on line 112
PHP Warning: Attempt to read property "id" on null in /var/www/html/libraries/src/Updater/Adapter/ExtensionAdapter.php on line 333

I am using administrators API key

But when I GET {{base_path}}/api/index.php/v1/banners I get correct response 200 OK

{
"links": {
"self": "http://SERVERNAME/api/index.php/v1/banners"
},
"data": [
{
"type": "banners",
"id": "1",
"attributes": {
"id": 1,
"name": "Test pasica",
"alias": "test-pasica",
"checked_out": null,
"checked_out_time": null,
"catid": 3,
"clicks": 0,
"metakey": "",
"sticky": 0,
"impmade": 0,
"imptotal": 0,
"state": 1,
"ordering": 1,
"purchase_type": -1,
"language": "*",
"publish_up": null,
"publish_down": null,
"language_image": null,
"editor": null,
"category_title": "Uncategorised",
"client_name": null,
"client_purchase_type": null
}
}
],
"meta": {
"total-pages": 1
}
}

It only works on banners

avatar xhorizont xhorizont - open - 10 Nov 2021
avatar joomla-cms-bot joomla-cms-bot - change - 10 Nov 2021
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 10 Nov 2021
avatar xhorizont xhorizont - change - 10 Nov 2021
Title
API Error
[4.0] API Error
avatar xhorizont xhorizont - edited - 10 Nov 2021
avatar bato3
bato3 - comment - 10 Nov 2021
  1. Can you update Joomla to 4.0.4 and test again?
  2. Is article 66 exists? (If not, I'm thinking, that should be 404)
  3. What's to happen when you change error reporting in Joomla to NONE?
avatar xhorizont
xhorizont - comment - 10 Nov 2021

66 exists
Joomla to NONE returns same error
I will make the update on friday night (already in production)

avatar alikon alikon - change - 10 Nov 2021
Labels Added: ?
avatar alikon alikon - labeled - 10 Nov 2021
avatar alikon
alikon - comment - 11 Nov 2021

you souldn't do a POST {{base_path}}/api/index.php/v1/content/articles/66 on a existing resource,

a correct post should be {{base_path}}/api/index.php/v1/content/articles to create a new article

avatar xhorizont
xhorizont - comment - 11 Nov 2021

you souldn't do a POST {{base_path}}/api/index.php/v1/content/articles/66 on a existing resource,

a correct post should be {{base_path}}/api/index.php/v1/content/articles to create a new article

Sorry I meant GET. I'll edit post

avatar xhorizont xhorizont - change - 11 Nov 2021
The description was changed
avatar xhorizont xhorizont - edited - 11 Nov 2021
avatar Quy
Quy - comment - 19 Nov 2021

I am unable to reproduce the error. The error in your log appears to be unrelated to this issue.

avatar xhorizont
xhorizont - comment - 21 Nov 2021

Finaly got some useful error

{
"errors": {
"code": 500,
"title": "Internal server error",
"detail": "ArgumentCountError: Too few arguments to function PlgContentSppagebuilder::onContentPrepare(), 3 passed in /var/www/html/libraries/src/Plugin/CMSPlugin.php on line 285 and exactly 4 expected in /var/www/html/plugins/content/sppagebuilder/sppagebuilder.php:93\nStack trace:\n#0 /var/www/html/libraries/src/Plugin/CMSPlugin.php(285): PlgContentSppagebuilder->onContentPrepare()\n#1 /var/www/html/libraries/vendor/joomla/event/src/Dispatcher.php(486): Joomla\CMS\Plugin\CMSPlugin->Joomla\CMS\Plugin\{closure}()\n#2 /var/www/html/libraries/src/Application/EventAware.php(111): Joomla\Event\Dispatcher->dispatch()\n#3 /var/www/html/api/components/com_content/src/View/Articles/JsonapiView.php(196): Joomla\CMS\Application\WebApplication->triggerEvent()\n#4 /var/www/html/libraries/src/MVC/View/JsonApiView.php(222): Joomla\Component\Content\Api\View\Articles\JsonapiView->prepareItem()\n#5 /var/www/html/api/components/com_content/src/View/Articles/JsonapiView.php(178): Joomla\CMS\MVC\View\JsonApiView->displayItem()\n#6 /var/www/html/libraries/src/MVC/Controller/ApiController.php(187): Joomla\Component\Content\Api\View\Articles\JsonapiView->displayItem()\n#7 /var/www/html/libraries/src/MVC/Controller/BaseController.php(730): Joomla\CMS\MVC\Controller\ApiController->displayItem()\n#8 /var/www/html/libraries/src/Dispatcher/ApiDispatcher.php(59): Joomla\CMS\MVC\Controller\BaseController->execute()\n#9 /var/www/html/libraries/src/Component/ComponentHelper.php(389): Joomla\CMS\Dispatcher\ApiDispatcher->dispatch()\n#10 /var/www/html/libraries/src/Application/ApiApplication.php(423): Joomla\CMS\Component\ComponentHelper::renderComponent()\n#11 /var/www/html/libraries/src/Application/ApiApplication.php(110): Joomla\CMS\Application\ApiApplication->dispatch()\n#12 /var/www/html/libraries/src/Application/CMSApplication.php(278): Joomla\CMS\Application\ApiApplication->doExecute()\n#13 /var/www/html/api/includes/app.php(54): Joomla\CMS\Application\CMSApplication->execute()\n#14 /var/www/html/api/index.php(31): require_once('...')\n#15 {main}"
}
}

avatar brianteeman
brianteeman - comment - 21 Nov 2021

and there is your answer and explanation why banners worked and articles produced an error.

Too few arguments to function PlgContentSppagebuilder::onContentPrepare()

The problem is int the SP Pagebuilder plugin

avatar alikon alikon - change - 21 Nov 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-11-21 13:05:32
Closed_By alikon
avatar alikon alikon - close - 21 Nov 2021
avatar alikon
alikon - comment - 21 Nov 2021

not a core issue

Add a Comment

Login with GitHub to post a comment