Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Joomla 4 support #130

Open
cappuccinonet opened this issue Sep 8, 2021 · 8 comments
Open

Joomla 4 support #130

cappuccinonet opened this issue Sep 8, 2021 · 8 comments

Comments

@cappuccinonet
Copy link

Please, could you let us know, if there are plans to support Joomla 4 with com_api as well?

@cappuccinonet cappuccinonet changed the title Joomla 4 migration Joomla 4 support Sep 8, 2021
@Syirasky
Copy link

Hello is there any update regarding the Joomla 4 support?

@counterpoint
Copy link

I'm pleased to see signs of development activity, but sadly this useful component doesn't seem to be operational on Joomla 4 yet. There is at least one instance of a Joomla call that doesn't work - Call to undefined method Joomla\CMS\Factory::getURI() in ...com_api/libraries/plugin.php:435. And Joomla 4 seems unable to route the menu entries generated by the component.

@counterpoint
Copy link

Maybe a bit cheeky to mention it here, but as I was stuck for a reliable way to create an API in Joomla 4, I created a plugin to make it easy. It doesn't have the functionality of com_api but does enough for me. You can see it at https://remository.com/downloads/Free-Joomla-Extensions/

@MarcelSchuermann
Copy link

MarcelSchuermann commented Feb 4, 2023

:getURI()

What about this error? Are there any solutions for J4? Anyone has a successful implementation?

What I found (fixing Type 500 Errors):

  • Factory::getURI() error:
    Factory:: getUri has been removed use Uri::getInstance() instead.
    https://docs.joomla.org/Potential_backward_compatibility_issues_in_Joomla_4
    Files:
    ..components\com_api\libraries\authentication\user.php
    ..components\com_api\libraries\plugin.php
    => Solultion: Replace Factory:: getUri() with Uri::getInstance()

  • Class "JArrayHelper" not found error
    The following classes and interfaces have been removed in Joomla! 4.0: JArrayHelper
    use Joomla\Utilities\ArrayHelper; instead.
    Files:
    ..administrator\components\com_api\controllers\keys.php
    ..administrator\components\com_api\tables\log.php
    => Solution: Replace JArrayHelper with ArrayHelper

Edit: After fixing this two errors I got rid of the 500 (Internal Server Errors).

Now I can connect from frontend to server but I get following 403 Error:

  • "API Rate Limit Exceeded"

My Rate Limit it high enough.

Any ideas how to fix this?

@MarcelSchuermann
Copy link

MarcelSchuermann commented Feb 4, 2023

To temporary fix this I can set rate limit to 0 (in backend > API > options).

Now I get following new 500 Error when using a POST (write) API-Call:
__clone method called on non-object

There seems to be a problem when I want to return some value with following function:
$this->plugin->setResponse();
If I just return nothing, there is no 500 Error.
Maybe it has something to do with the J4 plugin changes?
https://docs.joomla.org/Potential_backward_compatibility_issues_in_Joomla_4#Plugins

Any ideas / help?
@coolbung @parthlawate @ankush-maherwal @manojLondhe

@UmeshBhosale
Copy link
Contributor

UmeshBhosale commented Feb 6, 2023 via email

@MarcelSchuermann
Copy link

@UmeshBhosale Thanks for the feedback. I will make a ticket for further / bigger problems.

In the meantime I could fix following error:
__clone method called on non-object

By converting the API response from array:
$this->plugin->setResponse($output);
to an object:
$this->plugin->setResponse((object)$output);

Now only the API-Rate limit problem is to be fixed.

@UmeshBhosale
Copy link
Contributor

UmeshBhosale commented Feb 7, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants