Join the Ready, Set, Send Challenge Week 3. Share your QR code or landing page and win a badge!

API V3 - Updating a contact

TomP1
Rookie
0 Votes

Hello,

Im trying to use the PUT (update) a Contact route ( https://developer.constantcontact.com/api_reference/index.html#!/Contacts/putContact ) with no success. 
Here is the body I'm sending towards the route.

{
  "contact_id": "********************",
  "first_name": "John",
  "last_name": "Doe",
  "job_title": "",
  "company_name": "",
  "birthday_month": 11,
  "birthday_day": 18,
  "update_source": "Contact",
  "created_at": "2010-02-20T20:15:28Z",
  "updated_at": "2024-06-26T20:04:15Z",
  "custom_fields": [
    {
      "custom_field_id": "********************",
      "value": "Some Value"
    },
    {
      "custom_field_id": "********************",
      "value": "Some Value"
    },
    {
      "custom_field_id": "********************",
      "value": "Some Value"
    },
    {
      "custom_field_id": "********************",
      "value": "Some Value"
    },
    {
      "custom_field_id": "********************",
      "value": "Some Value"
    }
  ],
  "phone_numbers": [],
  "street_addresses": [
    {
      "street_address_id": "********************",
      "kind": "test",
      "street": "test",
      "city": "test",
      "state": "test",
      "postal_code": "test",
      "country": "test",
      "created_at": "2014-06-21T22:26:01Z",
      "updated_at": "2023-09-28T13:12:39Z"
    },
    {
      "street_address_id": "********************",
      "kind": "test",
      "city": "test",
      "state": "test",
      "country": "test",
      "created_at": "2014-07-08T18:01:48Z",
      "updated_at": "2014-11-11T00:23:48Z"
    }
  ],
  "list_memberships": [
    "********************",
    "********************",
    "********************"
  ],
  "email_address": {
    "address": "johndoe@test.com"
  }
}

 

 

 

Now if I don't include the "email_address" field I get as a response: 

[{"error_key":"contacts.api.validation.error","error_message":"email_address is missing"}]

but if I do include it I get:

[{"error_key":"contacts.api.conflict","error_message":"Validation failed: Email already exists for contact ************"}]


Am I doing something wrong? How do I actually utilize this endpoint. Am I missing something in the body?

Thank you.

1 REPLY 1
Courtney_E
Moderator
0 Votes

Hello TomP1,

 

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.

 

For a PUT call to /contacts, the contact ID should go in the request URL, rather than the request body. 

 

You can check the request URL details and body schema in our API Tester at the link below. In the upper right where it says "BODY SAMPLE" you can expand the section to see an example of how the JSON request body should be formatted.

 

PUT (update) a Contact

https://v3.developer.constantcontact.com/api_reference/index.html#!/Contacts/putContact

 

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

 

If you continue to run into issues, feel free to reach our team directly/securely via email at webservices@constantcontact.com with your full request URL and JSON request body, referencing case #32589373.


Regards,

Courtney E.
Tier II API Support Engineer

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.
Resources
Developer Portal

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

Visit Page

Announcements

API Updates

Join our list to be notified of new features and updates to our V3 API.

Sign Up