cancel
Showing results for 
Search instead for 
Did you mean: 

'first_name' value applied to 'company_name' when editing (POST) a contact via API Tester

Occasional Contributor

'first_name' value applied to 'company_name' when editing (POST) a contact via API Tester

Using the api/tester, the following POST request to edit a contact has the very strange behaviour of replacing the company name with the contact's first name.

 

{
  "job_title":"",
  "prefix_name":"",
  "first_name":"FFFFFFFF",
  "middle_name":"",
  "last_name":"SSSSSSSS",
  "addresses":[],
  "work_phone":"",
  "cell_phone":"",
  "company_name":"AAAAAAAA",
  "home_phone":"",
  "email_addresses":[
      {"status":"ACTIVE",
       "opt_in_source":"ACTION_BY_OWNER",
       "confirm_status":"NO_CONFIRMATION_REQUIRED",
       "email_address":"xxxxxx@yyyyy.com"
       }],
  
  "fax":"",
  "lists":[
      {"id":"147"},
      {"id":"151"},
      {"id":"162"}
      ],
  "notes":[],
  "custom_fields":[]
}

 

Status code=200 (fine) the headers look as follows:

 

Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate, no-cache="Set-Cookie" Content-Type: application/json;charset=UTF-8 Date: Thu, 26 Feb 2015 11:59:42 GMT Pragma: no-cache Server: Apache Vary: Accept-Encoding,User-Agent X-Mashery-Responder: prod-j-worker-us-east-1b-77.mashery.com X-Powered-By: Content-Length: 960 Connection: keep-alive

 

However the returned data replaces the `company_name` with the contact's `first_name`

 

{
   
"id": "12128",
   
"status": "ACTIVE",
   
"fax": "",
   
"addresses": [],
   
"notes": [],
   
"confirmed": false,
   
"lists": [{
       
"id": "147",
       
"status": "ACTIVE"
   
}, {
       
"id": "151",
       
"status": "ACTIVE"
   
}, {
       
"id": "162",
       
"status": "ACTIVE"
   
}],
   
"source": "",
   
"email_addresses": [{
       
"id": "92570b70-533f-11e3-8227-d4ae529a8612",
       
"status": "ACTIVE",
       
"confirm_status": "NO_CONFIRMATION_REQUIRED",
       
"opt_in_source": "ACTION_BY_OWNER",
       
"opt_in_date": "2013-09-04T14:40:17.000Z",
       
"email_address": "xxxxxx@yyyyy.com"
   
}],
   
"prefix_name": "",
   
"first_name": "FFFFFFFF",
   
"middle_name": "",
   
"last_name": "SSSSSSSS",
   
"job_title": "",
   
"company_name": "FFFFFFF",
   
"home_phone": "",
   
"work_phone": "",
   
"cell_phone": "",
   
"custom_fields": [],
   
"created_date": "2013-09-04T14:40:17.000Z",
   
"modified_date": "2015-02-26T11:49:06.000Z",
   
"source_details": ""
}

 

Could someone please explain what might be going wrong here.

 

Many thanks

3 REPLIES 3
Highlighted
Moderator

Re: 'first_name' value applied to 'company_name' when editing (POST) a contact via API Tester

Hi Gabrielle,

 

I tried the same call on my personal account, adding the contact to a single list,payload here:

 

{
 
"job_title":"",
 
"prefix_name":"",
 
"first_name":"FFFFFFFF",
 
"middle_name":"",
 
"last_name":"SSSSSSSS",
 
"addresses":[],
 
"work_phone":"",
 
"cell_phone":"",
 
"company_name":"AAAAAAAA",
 
"home_phone":"",
 
"email_addresses":[
     
{"status":"ACTIVE",
       
"opt_in_source":"ACTION_BY_OWNER",
       
"confirm_status":"NO_CONFIRMATION_REQUIRED",
       
"email_address":"xxxxxx@yyyyy.com"
       
}],
 
"fax":"",
 
"lists":[
     
{"id":"1719198141"}
     
],
 
"notes":[],
 
"custom_fields":[]
}

 

and I got the expected results, shown here:

 

201 Created


Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate, no-cache="Set-Cookie" Content-Type: application/json;charset=UTF-8 Date: Wed, 04 Mar 2015 21:39:22 GMT Location: https://api.constantcontact.com/v2/contacts/1657281845 Pragma: no-cache Server: Apache Vary: Accept-Encoding,User-Agent X-Mashery-Responder: prod-j-worker-us-east-1e-75.mashery.com X-Powered-By: Transfer-Encoding: chunked Connection: keep-alive

 

{
   
"id": "1657281845",
   
"status": "ACTIVE",
   
"fax": "",
   
"addresses": [],
   
"notes": [],
   
"confirmed": false,
   
"lists": [{
       
"id": "1719198141",
       
"status": "ACTIVE"
   
}],
   
"source": "API",
   
"email_addresses": [{
       
"id": "ec6a66b0-c2b6-11e4-8a71-d4ae529a848a",
       
"status": "ACTIVE",
       
"confirm_status": "NO_CONFIRMATION_REQUIRED",
       
"opt_in_source": "ACTION_BY_OWNER",
       
"opt_in_date": "2015-03-04T21:39:23.000Z",
       
"email_address": "xxxxxx@yyyyy.com"
   
}],
   
"prefix_name": "",
   
"first_name": "FFFFFFFF",
   
"middle_name": "",
   
"last_name": "SSSSSSSS",
   
"job_title": "",
   
"company_name": "AAAAAAAA",
   
"home_phone": "",
   
"work_phone": "",
   
"cell_phone": "",
   
"custom_fields": [],
   
"created_date": "2015-03-04T21:39:23.000Z",
   
"modified_date": "2015-03-04T21:39:23.000Z",
   
"source_details": "myapplication name"
}

Let me know if you need additional assistance in making your call work. If you are still seeing this situation, please PM me the credentials for the account this is occuring in, Username/password, access_token as well.

Rich Marcucella
Sr. Technical Writer, Content Developer
Web Services Team
http://developer.constantcontact.com
Member

Re: 'first_name' value applied to 'company_name' when editing (POST) a contact via API Tester

I have experienced the same issue while using the PHP API library. I have both libraries v1 and v2 but not sure which (or both) have the problem since I have been testing both versions. This problem occurs when submitting updated contact data but doesn't seem to manifest while adding a contact. I haven't verified if this occurs on all record updates (I've been testing with only a few records). No matter how many times I try to submit the same updated contact record, data in the last_name field is placed in the company_name field. Another problem I have while attempting to update a record (home_phone and fax fields are the only changes) is a failure message from the API, which is "The contact can not be opted in using 'ACTION_BY_OWNER'". However, the record is already an opt-in record and I have verified that it does not exist on the unsubscribe/optout list. Cheers
Honored Contributor

Re: 'first_name' value applied to 'company_name' when editing (POST) a contact via API Tester

Hello,

 

Based on what you've described, it sounds like the most likely scenario is that your trouble may be related to updating specific contacts or contacts that have duplicates in your account. Is it possible to recreate any of this behavior if you create a new contact and then try to update it?

 

If the behavior is not happening with new contacts, then it's likely that we need to look more closely at the specific contacts that you've been working on. I that is the case, then it would be best to collect up some information (such as the email addresses and contact IDs that are having issues) and email that to us at webservices@constantcontact.com.

 

Please let me know if you have any questions!

 

Sincerely,

Elijah G.
API Support Engineer