We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

How to add Custom Fields using API

SebastianM52
Participant

How to add Custom Fields using API

I am unable to add custom fields using API. I am getting below errors.

json.regex.mismatch.custom_fields:#/custom_fields/0/name: This attribute value must be of the format 'CustomFieldNN' using API

 

Here is my Sample code to add custom fields. 

CTCT.Components.Contacts.CustomField CustomField1 = new CTCT.Components.Contacts.CustomField();
CustomField1.Name = "Department";
CustomField1.Value = "Department 1";

 

CTCT.Components.Contacts.CustomField CustomField2 = new CTCT.Components.Contacts.CustomField();
CustomField2.Name = "Subject";
CustomField2.Value = "Test Subject";

c.CustomFields.Add(CustomField1);
c.CustomFields.Add(CustomField2);

 

Please help me.

 

1 REPLY 1
Jimmy_D
Moderator

Hi @SebastianM52,

 

Thank you for reaching out to Constant Contact's API Support.

 

The current version of our API is using and older version of the contacts system compared to what is available in our website UI. This means that the API does not currently support custom names when using the custom fields. You will need to use the naming structure of CustomFieldn. You can reference the below link for the differences between the API and the website.

 

http://developer.constantcontact.com/docs/contacts-api/api-gui-func.html


Regards,
Jimmy D.
Tier II API Support Engineer
Developer Portal

View API documentation, code samples, get your API key.

Visit Page