Rest API in Mautic 5 delivers empty result array but no error

Hey Guys,

MyMautic: 5.0.2 (VPS)
MyPHP Server: 8.1
MyPHP local 8.2.

I am using a php script to retrieve a mail with the Rest API. The code worked fine with Mautic 4.x. However, I am trying to use it on my Mautic 5.0.2 and unfortunately all I get as result is an empty email array
Are there known issues with the Rest API in Mautic 5? Or did I miss something, which I need to consider now in contrast to Mautic 4?

Thank you in advance for your help.

Kind regards,

Maybe there is no records?

What request are you issuing to the server?

Yeah, that is generally a good idea to check. Unfortunately, I tried mails and users without succes, both arrays are empty even though there are some entries in the database.

Is there anybody who already uses the API with PHP in Mautic 5? (I am pretty sure, I miss something but I am confused since my code is working fine with Mautic 4 but not with Mautic 5)

Can you paste the exact endpoint/url you are calling and request you are sending on that endpoint?

I’m having the same issue after upgrading to Mautic 5 from Mautic 4.
A quickfix for the moment is to disable setting of the serializer groups in Line 679 of app/bundles/ApiBundle/Controller/FetchCommonApiController.php. I just commented out this single line here. Now the returned entities are pretty large but it is a quickfix that works for me at the moment.

        if (!empty($this->serializerGroups)) {
//            $context->setGroups($this->serializerGroups);

Would highly appreciate a hint to a complete fix. I don’t understand where the relation between serializer group and fields that should be serialized is defined as I didn’t find any annotations on the entities.

There is a method in Entity\Lead.php that sets groups for this serializer.

I didn’t have time to look into it further, but could the issue occur due to the missing leadBasic serializerGroup in LeadApiController?