Programatically add an e-mail to a list

SOLVED
Go to solution
Participant

Programatically add an e-mail to a list

Looking through the documentation I found the POST to the contacts endpoint, but no documentation on how to format the POST body, only parameters.

 

What endpoints will I need to use to add a new contact to a specific list say, list id=55555. And how do I format the data I pass?

 

Thanks

1 ACCEPTED SOLUTION
Moderator

Hello,

 

The website for the POST endpoint (https://developer.constantcontact.com/docs/contacts-api/contacts-collection.html?method=POST) has an example of the JSON payload that you would pass along. You can test this out using our API Test page located here. https://constantcontact.mashery.com/io-docs

 

I've included that sample JSON payload below. 

 

{
	"addresses": [
    {
      "address_type": "PERSONAL",
      "city": "Cambridge",
      "country_code": "US",
      "line1": "541 Brighton Ave.",
      "line2": "Unit 785",
      "line3": "",
      "postal_code": "01555",
      "state_code": "MA",
      "sub_postal_code": ""
    }
	],
	"lists": [
		{
		"id": "55555"
		}
	],
	  "cell_phone": "555-555-5555",
	  "company_name": "System Optimzations",
	  "confirmed": false,
	  "email_addresses": [
		{
		"email_address": "username1@example.com"
		}
	],
  "fax": "555-555-5555",
  "first_name": "Ronald",
  "home_phone": "555-555-5555",
  "job_title": "Systems Analyst 3",
  "last_name": "Martone",
  "middle_name": "Angelo",
  "prefix_name": "Mr.",
  "work_phone": "555-555-5555"
}

Regards,
Jimmy D.
Tier II API Support Engineer

View solution in original post

1 REPLY 1
Moderator

Hello,

 

The website for the POST endpoint (https://developer.constantcontact.com/docs/contacts-api/contacts-collection.html?method=POST) has an example of the JSON payload that you would pass along. You can test this out using our API Test page located here. https://constantcontact.mashery.com/io-docs

 

I've included that sample JSON payload below. 

 

{
	"addresses": [
    {
      "address_type": "PERSONAL",
      "city": "Cambridge",
      "country_code": "US",
      "line1": "541 Brighton Ave.",
      "line2": "Unit 785",
      "line3": "",
      "postal_code": "01555",
      "state_code": "MA",
      "sub_postal_code": ""
    }
	],
	"lists": [
		{
		"id": "55555"
		}
	],
	  "cell_phone": "555-555-5555",
	  "company_name": "System Optimzations",
	  "confirmed": false,
	  "email_addresses": [
		{
		"email_address": "username1@example.com"
		}
	],
  "fax": "555-555-5555",
  "first_name": "Ronald",
  "home_phone": "555-555-5555",
  "job_title": "Systems Analyst 3",
  "last_name": "Martone",
  "middle_name": "Angelo",
  "prefix_name": "Mr.",
  "work_phone": "555-555-5555"
}

Regards,
Jimmy D.
Tier II API Support Engineer

View solution in original post

Developer Portal

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

Visit Page