Skip to content

Multiple API V3 Endpoints not working correctly? #307

@KW1-greysky

Description

@KW1-greysky

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": "[email protected]", "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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions