Error code 400.... Why?

I'm using PHP to subscribe people to a list. I want to set the value of a custom field, too, however, and when I include the "CustomFields" array in the "add" request, it bombs with this error:

Failed to deserialize your request.
Please check the documentation and try again.
Fields in error: subscriber

And here's a dump of the add request:

array(4) {
  string(25) ""
  string(11) "Josh xxxxxxx"
  array(2) {
    string(7) "ZipCode"
    string(5) "12345"

When I don't include the CustomFields array, it works fine and people are added to the list.

A couple things: The docs for adding subscribers ( Doesn't mention this error, nor does it identify the existence of a "subscriber" field, which is what the error is referencing.

Anyone ever encountered this before and/or have any suggestions?


roshodgekiss roshodgekiss, 4 years ago

Hey there joshrenaud, may I recommend that you take a look at our PHP wrapper for the Campaign Monitor API? In particular, the sample we have for adding subscribers. I think you'll find that our API is looking for an array within the CustomFields array.

The 400 error is a generic error response when a subscriber can't be added. If you're successfully adding subscribers when you remove CustomFields, there's very likely something in CustomFields that's baffling our API, so good sleuthing!

Thanks, joshrenaud - let us know how you go :)

Get in touch with us on Twitter:
We're also on Facebook:

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

Get started for free