API calls on a Joomla 4 website do not work anymore when SEBLOD 4 is installed.
Here what's returned by any calls you make :
Unable to load router: api
After some digging, we found the problem comes from the SEBLOD system plugin which tries to get the current app router but doesn't exist for the 'api' application. Here's what we've implemented to fix it in the 'onAfterInitialise()' method :
With this fix, we're able to make API Calls. But...
When we try to get list of articles, the Joomla API Application triggers content events and so the SEBLOD Content plugin 'onContentPrepare()' method is called. This raises new errors as SEBLOD seems to not know the context and still tries to work with the application Router.
We've implemented the same fix in the 'onContentPrepare()' SEBLOD content plugin method before the core code :
With these 2 fixes, we're now able to retrieve content articles with the API. The 'Text' property value of each article in the JSON is of course the SEBLOD tag stuff as no plugin prepare code is executed.
We've tested by adding a custom content plugin which updates the text property of the article when application is API and everything's working fine.
Hi @sebastienheraud ,
API calls on a Joomla 4 website do not work anymore when SEBLOD 4 is installed.
Here what's returned by any calls you make :
After some digging, we found the problem comes from the SEBLOD system plugin which tries to get the current app router but doesn't exist for the 'api' application. Here's what we've implemented to fix it in the 'onAfterInitialise()' method :
Before :
After :
With this fix, we're able to make API Calls. But...
When we try to get list of articles, the Joomla API Application triggers content events and so the SEBLOD Content plugin 'onContentPrepare()' method is called. This raises new errors as SEBLOD seems to not know the context and still tries to work with the application Router.
We've implemented the same fix in the 'onContentPrepare()' SEBLOD content plugin method before the core code :
With these 2 fixes, we're now able to retrieve content articles with the API. The 'Text' property value of each article in the JSON is of course the SEBLOD tag stuff as no plugin prepare code is executed.
We've tested by adding a custom content plugin which updates the text property of the article when application is API and everything's working fine.
Thx