Sample Add Contact API using VB dot Net

Regular Participant

Sample Add Contact API using VB dot Net

I copied the code from code scene and was able to add a new contact. I don't think I changed anything but now when I make the same call I get a response of 400

I can post to List 1, (General Interest), but not to a second list that I created using the Constant Contact web site.

I found the problem to actually be that once I deleted the list using the API, (I actually thought it only deleted the contacts and not the list because I had not logged off and back on from thbe Constant Contact web site). I use their site to add the list back in, but I still can not add new contacts to that site. If I create another list, (list 3), everything is cool again....

OK, I figured out that the list collection number is not related to the Sort Order, so initially when I added List2, then deleted and re-Added, its collection ID is now 3 not 2 which I thought was assigned by the sort order.
2 REPLIES 2
Regular Participant

Hi, I'm also getting error 400 (Bad Request), while trying to add multiple contacts using Bulk Activity. Can you help and let me know what is wrong with my data and why I'm getting this error? following is the Activity URI, List URI and request content I'm posting to activity uri to add contacts.

Activity Collection URI:
"http://api.constantcontact.com/ws/customers/username/activities"

List where contacts being added:
"http://api.constantcontact.com/ws/customers/username/lists/35"

application/x-www-form-urlencoded Request Data
"activityType%3dADD_CONTACTS%26data%3dEmail+Address%2c+First+Name%2c+Last+Name%0d%0af1l1%40email.com%2c+f1%2c+l1%0d%0af2l2%40email.com%2c+f2%2c+l2%0d%0af3l3%40email.com%2c+f3%2c+l3%26lists%3dhttp%3a%2f%2fapi.constantcontact.com%2fws%2fcustomers%2fusername%2flists%2f35"

Error I'm Getting:
The remote server returned an error: (400) Bad Request.

Regards

Akhilesh
Regular Participant

I think the problem is that you should be using activityType="SV_ADD"

Here is what I am using...

activityType=SV_ADD&data=Email+Address%2cEmail+Type%2cFirst+Name%2cLast+Name%0aTestUser706%40aol.com%2cHTML%2cTest%2cUser706&lists=http%3a%2f%2fapi.constantcontact.com%2fws%2fcustomers%2fUSERNAME%2flists%2f1
Developer Portal

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

Visit Page