Followers Are Great, Contacts Are Gold. Create a Free AI-Quiz With Lead Magnet to Share With Your Followers and Own Your Contacts!

V3 API suddenly failing with both post and put requests

RonaldA9
Rookie
0 Votes

I have a custom form for our patrons to subscribe to our email list, which has been working for a long time. As of today we cannot add new subscribers (post request) or update existing subscribers (put request) because we get the following error:

 

requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.cc.email/v3/contacts

 

Here is the post request with names and field ids changed to protect the innocent:

 

{'contact_data': {'create_source': 'Contact',
'custom_fields': [{'custom_field_id': '54ab04ba-b9f2-11ed-987c-fa163eb65cb7',
'value': ''}],
'email_address': {'address': 'ronaldaaronson@hotmail.com',
'confirm_status': 'off',
'permission_to_send': 'explicit'},
'first_name': 'Ron',
'last_name': 'Aaronson',
'list_memberships': ['c175661c-b9e8-11ed-b3a8-fa163e0234d4'],
'phone_numbers': [{'kind': 'home',
'phone_number': ''},
{'kind': 'mobile',
'phone_number': ''},
{'kind': 'work',
'phone_number': ''}],
'street_addresses': [{'city': '',
'country': 'US',
'kind': 'home',
'postal_code': '',
'state': '',
'street': ''}]},
'request_type': 'post',
'url': 'https://api.cc.email/v3/contacts'}

 

As an image with better formatting:

 

RonaldA9_0-1740256693062.png

 

Any help is appreciated!

2 REPLIES 2
John__B
Employee
0 Votes

Hello RonaldA9,

 

Thank you for reaching out to Constant Contact API Developer Support. My team is here to assist outside software developers with questions about building into Constant Contact's API.

 

This error appears to be due to an issue that we recently started receiving reports of regarding Custom Fields no longer accepting blank values in V3 API requests. Currently our engineering team is looking into the root cause of this new behavior and how to best address it on our end.

 

In the meantime, what we suggest as a workaround is to programmatically check the Custom Field values in your payload before sending a request, and if the string is empty, either remove the field from the request or replace the empty string with null. 

 

Example (before):

 

{"email_address": "jdodge@example.com",

  "list_memberships": [  "07936f78-662a-11eb-af0a-fa163e56c9b0"  ],

  "custom_fields": [    

{"custom_field_id": "1618ae62-4752-11e9-9c8a-fa163e6b01c1", "value": "Saturday" },

{"custom_field_id": "3fa85f64-5717-4562-b3fc-2c963f66afa", "value": "" }

 ] }

 

Updated Example (adding null):

 

{"email_address": "jdodge@example.com",

  "list_memberships": [  "07936f78-662a-11eb-af0a-fa163e56c9b0"  ],

  "custom_fields": [    

{"custom_field_id": "1618ae62-4752-11e9-9c8a-fa163e6b01c1", "value": "Saturday" },

{"custom_field_id": "3fa85f64-5717-4562-b3fc-2c963f66afa", "value": null }

 ] }

 

Updated Example (removing custom field):

 

{"email_address": "jdodge@example.com",

  "list_memberships": [  "07936f78-662a-11eb-af0a-fa163e56c9b0"  ],

  "custom_fields": [    

{"custom_field_id": "1618ae62-4752-11e9-9c8a-fa163e6b01c1", "value": "Saturday" }

] }

 

We will be sure to follow up on this thread as soon as we have an update for this issue.

 

Please have a look and let us know if you have any other questions!

 

Regards,


John B.
API Support Specialist
Did I answer your question? If so, please mark my post as an "Accepted Solution" by clicking the Accept as Solution button in the bottom right hand corner of this post.
RonaldA9
Rookie
0 Votes

Thanks for the reply. If I set the custom field value to null, will it be ignored by your sever with the original value I had for the field remaining unchanged or will the value be reset to an empty string?

Resources
Developer Portal

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

Visit Page