The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Exhaustive List of Field Names?

SOLVED
Go to solution
Highlighted
Occasional Participant

Exhaustive List of Field Names?

Hi,

 

   I've developed to the API using the python libraries supplied by ctct.  Very nice.  The API is simple and easy to use.  I've started adding some more robust data to my application and have found that some of the field names that I'm using are getting rejected by the server when I post the data.  Specifically, I have been trying to use the create_activity functionality to add/update multiple subscribers at a time.  In the README file that comes with the python library, there is a list of fields returned from the API when requesting subscriber information:

 

    id

    updated

    status

    email_address

    email_type

    name

    first_name

    middle_name

    last_name

    job_title

    company_name

    home_phone

    work_phone

    addr1

    addr2

    addr3

    city

    state_code

    state_name

    country_code

    country_name

    postal_code

    sub_postal_code

    note

    custom_field1

    ...

    custom_field15

    contact_lists

I used these field names to name the columns in my import data.  Apparently some of them are not being accepted as I am getting a 400 return code with a message about bad upload data.  Can anyone tell me what ALL of the field names are that should be used when adding/updating subscriber information?
Many Thanks,
-Scot
Windsor Circle
Durham, NC
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Employee

Re: Exhaustive List of Field Names?

Hello,

 

I apologize I did not realize you were doing a bulk import, I thought you were adding contacts individually.  For bulk activities in the python library you would have to do it with their proper names.  The names for each one can be found here.

 

If you have any questions please let me know.

 

Regards,

Benjamin Soder
NOC Analyst
Constant Contact

View solution in original post

10 REPLIES 10
Highlighted
Employee

Re: Exhaustive List of Field Names?

Hello,

 

I believe that those fields should work fine.  Is it possible for you to send me your code?  You can email it here, and we will take a look at it and see if we can find out what is going on.

 

Regards,

Benjamin Soder
NOC Analyst
Constant Contact
Highlighted
Occasional Participant

Re: Exhaustive List of Field Names?

Benjamin,

 

   Thanks, I appreciate the help.  I'm not sure that my code will be of much use unless you can see what my data structures contain.  I think the way my code is written, it may be hard to cut and paste the relevant parts and have it make sense.  Let me start by showing you the data structures and then the params sent in the URL.  Perhaps you can spot something there.  Here's the dictionary that contains the "rows" and "columns" elements:

 

 

{
   "rows": [
      [
         "Liz.Buck40@yahoo.com", 
         "Liz", 
         "Buck", 
         "27701"
      ], 
      [
         "Cheryl.Harris26@hotmail.com", 
         "Cheryl", 
         "Harris", 
         "27701"
      ]
   ], 
   "columns": [
      "email_address", 
      "first_name", 
      "last_name", 
      "postal_code"
   ]
}

 When I pass that along to the creat_activity() method in ctctwspylib, I get these params that are passed to the API:

 

activityType=SV_ADD
&data=email_address%2Cfirst_name%2Clast_name%2Cpostal_code%0A
Liz.Buck40%40yahoo.com%2CLiz%2CBuck%2C27701%0A
Cheryl.Harris26%40hotmail.com%2CCheryl%2CHarris%2C27701
&lists=http%3A%2F%2Fapi.constantcontact.com%2Fws%2Fcustomers%2FXXXXXXX%2Flists%2F1

 

Everything above is exactly as it is sent to the API except that I changed the customer ID in the list URL to X's for security purposes.  Decoded, it looks like this (for readability):

 

activityType=SV_ADD
&data=email_address,first_name,last_name,postal_code
Liz.Buck40@yahoo.com,Liz,Buck,27701
Cheryl.Harris26@hotmail.com,Cheryl,Harris,27701
&lists=http://api.constantcontact.com/ws/customers/XXXXXXX/lists/1

 

On a whim, I tried changing the field names to the same as are given in the examples in the README file that came with the ctctwspylib library.  (email_address = Email Address, first_name = First Name and last_name = Last Name).  When I did so, it worked.  I was not able to find the equivalent for postal_code, though.

 

Thanks for your help.

 

-Scot

 

Highlighted
Occasional Participant

Re: Exhaustive List of Field Names?

Oh, and...  If this isn't enough information and you'd still like to see the code, I'll see if I can cobble together a standalone outside of my library that exhibits the same issue and post it for you.

 

Thanks,

 

-Scot

Highlighted
Occasional Participant

Re: Exhaustive List of Field Names?

UPDATE:

 

It seems that the culprit is the original list of field names.  If I use any of those field names I get "Error 400: Bad upload data" in the response body.  If I use the proper names, it works.  The problem is that I cannot guess at what the proper names would be for all the fields I would like to use.

 

It sounds like you're saying that the underscored field name ought to work and I certainly agree.  However, I can change my code to use the proper names if you can send me a list of what they are.

 

Thanks again,

 

-Scot

Highlighted
Employee

Re: Exhaustive List of Field Names?

Hello,

 

I apologize I did not realize you were doing a bulk import, I thought you were adding contacts individually.  For bulk activities in the python library you would have to do it with their proper names.  The names for each one can be found here.

 

If you have any questions please let me know.

 

Regards,

Benjamin Soder
NOC Analyst
Constant Contact

View solution in original post

Highlighted
Occasional Participant

Re: Exhaustive List of Field Names?

Benjamin,

 

That's great.  Much appreciated.  I'm sure that'll do the trick.  You might want to have someone update the README file that comes with the python libraries and put that in the create_activity section.  That would be very helpful.

 

Have a great one.

 

-Scot

Highlighted
Occasional Participant

Re: Exhaustive List of Field Names?

Benjamin,

 

Sorry.  I spoke too soon.  I tried adding just the "Zip/Postal Code" field and I still get the same 400 error message.  Here's what I'm posting.

 

activityType=SV_ADD&data=Email+Address%2CFirst+Name%2CLast+Name%2CZip%2FPostal+Code%0ALiz.Buck40%40yahoo.com%2CLiz%2CBuck%2C27701%0ACheryl.Harris26%40hotmail.com%2CCheryl%2CHarris%2C27701&lists=http%3A%2F%2Fapi.constantcontact.com%2Fws%2Fcustomers%2Fcat1013%2Flists%2F1


activityType=SV_ADD&data=Email+Address,First+Name,Last+Name,Zip/Postal+Code
Liz.Buck40@yahoo.com,Liz,Buck,27701
Cheryl.Harris26@hotmail.com,Cheryl,Harris,27701&lists=http://api.constantcontact.com/ws/customers/cat1013/lists/1

 Any ideas?

 

-Scot

Highlighted
Employee

Re: Exhaustive List of Field Names?

Hello,

 

The Zip/Postal code actually needs to be posted as "Postal Code".  I am going to look into this because our FAQ currently has Zip/Postal code, and it is not the same in the API.

 

I will find out if the FAQ is wrong, or if the API needs to be changed, and I will post back here with my results.

 

Regards,

Benjamin Soder
NOC Analyst
Constant Contact
Highlighted
Occasional Participant

Re: Exhaustive List of Field Names?

Thanks again, Benjamin.

 

I did some trial-and-error testing and found that some of the fields listed on the page referenced work and others don't.  "Postal Code" does not work along with "Country" and a few others.

 

I'll wait to hear what you find.

 

Cheers,

 

-Scot

Developer Portal

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

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured