How to add Custom Fields using API

Highlighted
Occasional Contributor

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
Highlighted
Moderator

Re: How to add Custom Fields using API

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

Register for our "Making Sense of Online Marketing for Retail" Webinar

Join us on Thursday, August 13th at 2pm ET for a free webinar where we'll discuss how to incorporate online marketing into your retail store.

Read More
Featured