Joomla 4 API With Helix - Question | JoomShaper

Joomla 4 API With Helix

TC

Terry Carter

Helix Framework 1 year ago

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?

0
13 Answers
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
Accepted Answer
1 year ago #72081

@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.

1
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #71803

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

0
TC
Terry Carter
Accepted Answer
1 year ago #71822

Please see the attached video

0
TC
Terry Carter
Accepted Answer
1 year ago #71901

any update on this

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #71954

I have checked your site my end and it works fine. Can you share a screencast video start to end how did you start?

https://prnt.sc/I98p1j3AJwdK

0
TC
Terry Carter
Accepted Answer
1 year ago #71999

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.

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #72007

I have checked my end and it works fine.

https://prnt.sc/f7Z3Esf1ZqoZ

-1
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
Accepted Answer
1 year ago #72023

@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}" } ] }

1
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #72075

I have followed this process. Please watch the video and try to apply your end.

https://www.youtube.com/watch?v=lT9qodsvfZg

-1
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #72105

I have informed our devloper team to check it. I hope they will check & get back to you soon. Thanks

1
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #72106

Please update your profile picture and profile name (last reply). Thanks

-1
TC
Terry Carter
Accepted Answer
1 year ago #72128

@jens thank you so very much. This worked perfectly.

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #72200

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

-1