Below is the sample code and error:
curl --location --request POST 'https://api.constantcontact.com/v2/contacts?action_by=ACTION_BY_VISITOR&api_key=ABC' \
--header 'Authorization: Bearer ******-****-****-****-fe6ece0ea069' \
--header 'Content-Type: application/json' \
--data-raw '{
"email_address": {
"address": "test1142021@test.com",
"permission_to_send": "implicit"
},
"first_name": "test",
"last_name": "test"
}'
Error:
Hello @LizC655,
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.
After working on this issue via email, we saw there were a combination of issues between missing elements and an invalid property being used. That invalid property in the code is "permission_to_send". Also the code was missing some brackets, a list to add the contact to, and the opt_in_source for the contact. Just in case, below is an example of the coding with invalid properties removed and missing elements added.
POST Address I Used:
https://api.constantcontact.com/v2/contacts?api_key=ABC&action_by=ACTION_BY_VISITOR
{
"email_addresses":
[
{
"opt_in_source": "ACTION_BY_VISITOR",
"email_address": "test1142021@test.com"
}
],
"first_name": "test",
"last_name": "test",
"lists": [
{
"id": "123456"
}
]
}
Also, below is a link to documentation which has all a list of all the valid fields when doing a POST for adding a contact.
Contacts Collection Endpoint
https://v2.developer.constantcontact.com/docs/contacts-api/contacts-collection.html?method=POST
Please feel free to respond to the email if you have any additional questions.
Regards,
Announcements
Join our list to be notified of new features and updates to our V3 API.
Sign Up