Deserialized Object of getEmailCampgain in PHP is empty

Hej,

I get an empty object when trying to get an emailCampaign by id even if there is content in the response but the deserialization does it make empty.

I do the call on the PHP 2.0.0 library getEmailCampaign().

Any suggestions?

Thanx

Pat

Hi @Peyotito , thanks for posting on this community.

even if there is content in the response but the deserialization does it make empty

do you mean the problem lies in the deserialization, or in the response itself?

Hej,

thanx for helping in thus issue.

I think the problem is possibly the deserialization respectively the GetEmailCampain model in the client code.
Because using the direct API call on Get an email campaign report gets a correct HTTP 200 response.
Line 1311 in EmailCampaingsApi.php gets back an empty object by the deserializer while the response in $content looks corect for me.

Maybe there is a new value added wich is not handled by the deserialization?

You mean there is an issue directly in Brevo’s API endpoint code?

adding @Mauricio to this thread, so that maybe you can check Brevo’s API endpoint, to be sure everything goes well

No, I don’t think the issue is in the endpoint.

I think, it’s in your PHP API library GitHub - getbrevo/brevo-php: A fully-featured PHP API client to interact with Brevo.

This code is suggest for PHP in your documentation:

try {
    $result = $apiInstance->getEmailCampaign($campaignId);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling EmailCampaignsApi->getEmailCampaign: ', $e->getMessage(), PHP_EOL;
}

But the print_r command doesn’t work. I get back an Brevo\Client\Model\GetEmailCampaign Object.

We can close this issue.

i was misleaded by the example code.

I get back an Object and of course I can get all the vaues I need from that.

Thanks anyway

Hi @Peyotito , thanks for the update. I was about to reply that we checked and that everything seemed correct, see this example: brevo-php/docs/Api/EmailCampaignsApi.md at main · getbrevo/brevo-php · GitHub