I am trying to access the Joomla 4 API with Postman. If I disable System - Helix3 Framework I can access the API with no issues. If System - Helix3 Framework is enabled I am receiving a Server 500 error. Is there a fix for this?
Joomla 4 API with Helix
Accepted answer
Marked as the solution@Terry Because of Toufiq not understanding the problem, I have checked the helix3.php.
To resolve the issue, you need to change the following line.
/plugins/system/helix3/helix3.php Line: 60
before:
if( !JFactory::getApplication()->isClient('administrator') ) {
after:
if( !JFactory::getApplication()->isClient('api') && !JFactory::getApplication()->isClient('administrator') ) {
This makes sure the code is not called, if a api-request was made and prevents the error.
The root cause is, when a api call is made, there is no template-instance for the menus and this leads to this error.
Please be also aware, that Joomshaper does not activly support helix3 anymore. "EOL = end of life"
-> https://github.com/JoomShaper/Helix3
I will add this fix to my pullrequest and hope they will fix it asap.
Have a nice week.
addendum: Please note that when updating the Melvin template, this change will also be lost and the problem can or will occur again.
12 more replies
Hi there,
Thanks for contacting us. Sorry for the inconvenience. Will you please provide me the Joomla administrator access to check the issue? I will check & get back to you soon.
Note: Can you share a screencast video of the full scenario?
-Thanks
Please see the attached video
any update on this
I have checked your site my end and it works fine. Can you share a screencast video start to end how did you start?
I did share a screencast.
the printscreen you shared is just a GET of our sites root, which is not the API url. please issue yourself a web api token and test the api.
I have checked my end and it works fine.
@Toufiq Please check the Collection you are using.
It looks like, you are using the wrong collection.
Joomla-Documentation.
https://docs.joomla.org/J4.x:Joomla_Core_APIs#Get_Single_Article
Collections for postman:
https://docs.joomla.org/J4.x:Joomla_Core_APIs#Useful_Resources
When you check the url, you will see the difference.
You have requested: /content/article/28
What you should have requested: /api/v1/content/articles/28
Your received: HTML
What you should have received, with the correct url: JSON
I did the Test with the melvin-template, which Terry is using and could replicate the issue.
{
"errors": [
{
"code": 500,
"title": "Internal server error",
"detail": "InvalidArgumentException: Error loading menu: api in /libraries/src/Menu/MenuFactory.php:40\nStack trace:\n#0 /libraries/src/Menu/AbstractMenu.php(124): Joomla\CMS\Menu\MenuFactory->createMenu()\n#1 /libraries/src/Application/CMSApplication.php(518): Joomla\CMS\Menu\AbstractMenu::getInstance()\n#2 /plugins/system/helix3/helix3.php(62): Joomla\CMS\Application\CMSApplication->getMenu()\n#3 /libraries/src/Plugin/CMSPlugin.php(285): plgSystemHelix3->onAfterDispatch()\n#4 /libraries/vendor/joomla/event/src/Dispatcher.php(486): Joomla\CMS\Plugin\CMSPlugin->Joomla\CMS\Plugin\{closure}()\n#5 /libraries/src/Application/EventAware.php(111): Joomla\Event\Dispatcher->dispatch()\n#6 /libraries/src/Application/ApiApplication.php(428): Joomla\CMS\Application\WebApplication->triggerEvent()\n#7 /libraries/src/Application/ApiApplication.php(110): Joomla\CMS\Application\ApiApplication->dispatch()\n#8 /libraries/src/Application/CMSApplication.php(278): Joomla\CMS\Application\ApiApplication->doExecute()\n#9 /api/includes/app.php(54): Joomla\CMS\Application\CMSApplication->execute()\n#10 /api/index.php(31): require_once('...')\n#11 {main}"
}
]
}
I have followed this process. Please watch the video and try to apply your end.
I have informed our devloper team to check it. I hope they will check & get back to you soon. Thanks
Please update your profile picture and profile name (last reply). Thanks
@jens thank you so very much. This worked perfectly.
Official solution
Go to this file location
plugins/system/helix3/helix3.php
Find out this code
if( !JFactory::getApplication()->isClient('administrator') )
And replace with this code
if( !JFactory::getApplication()->isClient('administrator') && !JFactory::getApplication()->isClient('api') )
-Thanks