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

Multiple API V3 Endpoints not working correctly? #307

Open
KW1-greysky opened this issue Sep 20, 2024 · 1 comment
Open

Multiple API V3 Endpoints not working correctly? #307

KW1-greysky opened this issue Sep 20, 2024 · 1 comment

Comments

@KW1-greysky
Copy link

KW1-greysky commented Sep 20, 2024

Hey there!

i am currently testing the API V3 within a custom wordpress plugin for our company. We currently use a Free Plan to develop and we use your provided PHP Wrapper - which works perfectly fine for (most of) the API endpoints. But i have discovered some strange behaviour within some of the API endpoints. I am now wondering if i did something wrong or is the API messed up?

Used Software:

  • PHP: 8.2
  • WP: 6.6.2
  • Mailjet PHP Wrapper: dev-master 04c0a3c
  • Mailjet API v3
  • Mailjet Sent API v3.1

API Connection:

$this->apiVersion = "v3";

$this->mj = new \Mailjet\Client( 
    $this->apiKey, 
    $this->apiSecret, 
    true, 
    ['version' => $this->apiVersion]
);

API Endpoint https://api.mailjet.com/v3/REST/campaign:

Request (it doesnt even work without the filters):

public function get_campaigns() {
        // set some filters for the request
        $filters = [
            "Limit" => 1000
        ];

        $response = $this->mj->get(Resources::$Campaign, ["filters" => $filters]);

        if ($response->success()) {
            return $response->getData();
        } else {
            return [
                'error' => true,
                'status' => $response->getStatus(),
                'message' => $response->getReasonPhrase()
            ];
        }
    }

Response expected:
array(1){ "Count": 1, "Data": [ { "IsDeleted": false, "IsStarred": false, "CampaignType": 2, "ClickTracked": 1, "CreatedAt": "2018-01-01T00:00:00", "CustomValue": "CustomTag", "FirstMessageID": 1234567890987654400, "FromEmail": "pilot@mailjet.com", "FromID": 123456, "FromName": "Your Mailjet Pilot", "HasHtmlCount": 1, "HasTxtCount": 1, "ID": 987654321234568000, "ListID": 567890, "NewsLetterID": 3456789, "OpenTracked": 1, "SegmentationID": 123, "SendEndAt": "2018-01-01T00:00:00", "SendStartAt": "2018-01-01T00:00:00", "SpamassScore": "0", "Status": 0, "Subject": "Your email flight plan!", "UnsubscribeTrackedCount": 0, "WorkflowID": 1234 } ], "Total": 1 }

Response actually:
array(0) { }

Just one of many API Endpoints that doesnt work (for me). Another API Endpoint is https://api.mailjet.com/v3/REST/campaigndraft. I can get sent campaings via the Campaigndraft Endpoint by setting the Status filter. Then i get all sent campaigns - which are obiously not in draft anymore - over the Campaigndraft Endpoint. This would be fine with me if there wasnt the problem, that this list of campaigns contains the WRONG campaign ids. I expect the campaign ID to be "6509134" but i get "255950". This is some strange behaviour that is going on there.

Here is also a (not at all) complete list of endpoints that dont work at all or return (partially) wrong data:

If there is still important information missing please tell me and i will try to provide the missing infos.

Cheers!

@oleksandr-mykhailenko
Copy link
Collaborator

Hello @KW1-greysky
Thank you for noticing this. We are working and see some not expected behaviour

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

2 participants