1

We had recently upgraded our Joomla site from 3.x to 4.x. We now have a requirement to connect to Joomla core APIs. But we are not able to do so. It is giving error: Unable to load router: api .../libraries/src/Router/Router.php:115

The URL we are trying is : api/index.php/v1/content/articles/42

Bearer token is used for authentication.

Can anyone give me an insight to what needs to be done to solve this?

Thank you.

3
  • Enable debug and post stack trace. Commented Jul 25, 2024 at 8:41
  • I have fixed it after commenting the last line of libraries/src/Application/ApiApplication.php. The code that I commented is : //$this->triggerEvent('onAfterDispatch'); . The issue was not seen in a fresh installation of Joomla 4, but in the one upgraded from 3 to 4. May be it will be helpful of someone facing the same problem.. Commented Jul 25, 2024 at 15:44
  • This is not a solution. You must never edit core files, your changes will be lost on update. Also the change is plain wrong, it removes onAfterDispatch event which means plugins can no longer respond to it. What this does tell us is that the issue is coming from some plugin responding to onAfterDispatch. If you enable debug, you may be able to see which plugin exactly is causing the issue. Commented Jul 26, 2024 at 5:17

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.