PHP Wrapper for Creating Campaigns

Using the new classes that are available for V3 in PHP... I'm unable to create a campaign. I have followed the documentation exactly, double checked all of my API and ID's but the script fails right after $wrap->create();

There is no further output, it just dies. Any feedback?

tobyb tobyb, 6 years ago

Hi akicreative,

Thanks for getting in touch and jumping on the new API straight away. We've just push up a slight revision to the wrapper on GitHub which fixes the problem you we're seeing.

As usual you can grab the latest version here.
Details of the change are here

akicreative, 6 years ago

Perfect!

Chocksy, 6 years ago

Hello,

I tried to create a campaign also using the new API but i get this error:

Result of POST /api/v3/campaigns/{clientID}
Failed with code 400
object(stdClass)#5 (2) {
  ["Code"]=>
  int(400)
  ["Message"]=>
  string(110) "Failed to deserialize your request.
Please check the documentation and try again.
Fields in error: campaign"
}

Do you have any idea why i get this?

Thanks in advance.

tobyb tobyb, 6 years ago
Chocksy :

Result of POST /api/v3/campaigns/{clientID}
Failed with code 400
object(stdClass)#5 (2) {
  ["Code"]=>
  int(400)
  ["Message"]=>
  string(110) "Failed to deserialize your request.
Please check the documentation and try again.
Fields in error: campaign"
}

Do you have any idea why i get this?

Not without checking the input that your providing, do you want to double check your usage (perhaps even just replace only the API key and ClientID in the sample, try again and work from there). If your still having trouble send through an email to [support at campaignmonitor.com] with your your account details and we'll have a look into it for you.

mrvdot, 5 years ago

I'm having the same error while trying to add a subscriber. It looks like the error is in the customfields array, as I've successfully added a user if I remove those from my submission. Can you provide an example of what exactly the 'Key' value should look like. I've tried actual field name (ie. Address Line 1), and personalization value (ie. 'AddressLine1') both with and without brackets, but seem to get the error every time. I've included the var_dump of my customfields array, using field keys without brackets as seem be indicated by the actual code (though not the sample).
Thanks,
Alex

array(7) {
  [0]=>
  array(2) {
    ["Key"]=>
    string(12) "AddressLine1"
    ["Value"]=>
    string(17) "123 E. Street"
  }
  [1]=>
  array(2) {
    ["Key"]=>
    string(12) "AddressLine2"
    ["Value"]=>
    string(6) "Apt. 3"
  }
  [2]=>
  array(2) {
    ["Key"]=>
    string(4) "City"
    ["Value"]=>
    string(9) "Somewhere"
  }
  [3]=>
  array(2) {
    ["Key"]=>
    string(5) "State"
    ["Value"]=>
    string(2) "22"
  }
  [4]=>
  array(2) {
    ["Key"]=>
    string(3) "Zip"
    ["Value"]=>
    string(5) "11111"
  }
  [5]=>
  array(2) {
    ["Key"]=>
    string(8) "Dropdown"
    ["Value"]=>
    string(1) "0"
  }
  [6]=>
  array(2) {
    ["Key"]=>
    string(11) "CheckboxSet"
    ["Value"]=>
    array(1) {
      [0]=>
      string(1) "0"
    }
  }
}
mrvdot, 5 years ago

Ok, update: it is a problem with the 'MultiSelectMany' field type. If I remove that, everything else works fine. Any suggestions on how best to submit that data? Thanks again

mrvdot, 5 years ago

Ok, finally, got it all set, turns out there's a short sentence at the top of the API doc on lists that says MultiSelectMany values have to be sent in multiple arrays, not just one. Thanks anyway

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free
1-888-533-8098