I'm finding that there's inconsistency in custom field keys used in the API. When I add a subscriber to a list via the API, I must use the Personalization Tag of the field as the custom field key. However, when I get the data back (i.e. getSingleSubscriber), the key used is the full Field Name. This seems odd and causes a number of exceptions I must code for.
Also, after discovering this, I thought for the sake of consistency (and sanity), I would just set the Personalization Tags to be the same as the Field Names, but this doesn't appear possible. Am I missing something?
That's really strange. For both adding a subscriber and getting the data back via GetSingleSubscriber. It should be the Field Name that is used. I've just tried this out, and found it to be so.
Could you possibly email firstname.lastname@example.org with your details, in particular the subscriber list and custom field that you're working on, and include the relevant code that you're using? Once you've done that, we can take a closer look at what's going on.
Thanks for the reply. I will admit that I haven't tried using the full Field Name as the key when _adding_ subscribers via the API (though I will go try this now). I haven't done so because your documentation explicitly says to use the Personalization Tag (minus the fallback text, of course) as the key for custom fields.
http://www.campaignmonitor.com/api/required/ (see the Custom Fields section)
When retrieving a subscriber, I've done a simple loop through the custom fields and displayed the keys, and they're the full Field Names.
Then, add to this that that forms embedded on my site that submit directly to Campaign Monitor must use yet another value (something like cm-abcabc-abcabc), and there's a lot of different circumstances to account for.
Oops! How embarrassing! I've made a mistake.
We first attempt to match on the Personalization Tag. If that can't be found, we match on the Field Name.
Again, if you're still having problems, fire an email at email@example.com
From Australia to Zimbabwe, and everywhere in between, companies count on Campaign Monitor for email campaigns that boost the bottom line.Get started for free