I get the URL by creating a list and then passing it in the lists field.
I keep getting (415) Unsupported Media Type
Here is what I am using:
request.ContentType = "multipart/form-data"
I realized I was posting to the list URI instead of the activities one
Now I am posting to
And I am getting a 400 Bad request error.
I also tried adding fileType = CSV and changing dataFile to FileName, I don't reallly know what the difference between those are.
When using multipart/form-data, you must send the contents of the csv file as the value for data file, not the name of the file. This varies on how you do this depending on the language, typically you just need to read the file to your request stream on most languages. PHP is slightly different and we can get a sample of how to do this if you need one.
It's worth mentioning, we are in the process of updating the sample code packs to include code for doing these types of imports as well. Will update everyone once the new samples are done.
Ok is there any limit to the amount of data that can be passed in this manner? Could I upload thousands of emails by just building out one long string of data?
The limit to uploading a number of contacts using our Activities Collection, as well as in our User Interface, is 20,000 contacts at a time.
It is confusing that you mention file types. I can have whatever file type I want since I must read it in myself and convert it to a string. IT doesn't make sense to say you can have txt or csv file. I must read whatever file I have into memory and then send it, or am I missing something?
I am getting a 400 Bad Request response. Any ideas of what could be causing the problem?
This string looks to be formatted correctly, and I was able to use it to create contacts in my account without an issue. The one thing that did cause a 400 error at first was the fact that I do not have a list with the id of '31'. Once I modified this to a list id in my account (ie: 1), this string worked properly. I would check to insure you do have a list with the id of 31. You can determine which list id's belong with which list by performing an http get on the lists collection, which you can find more information on here. I would also check to insure that there are no unintended whitespace or linebreak characters included in your request body.
Regarding your earlier comment on us the documentation for this bulk upload saying you can have a text or csv file, this is meant as more of a deterrent from people using an excel file with this method, which should be uploaded using a multipart/from-data request, but I certainly apologize for any confusion that this has caused.
Please let me know if you have any other questions or are still experiencing difficulties getting this action to work and I will be happy to help.
I am creating the list in the same program. I am using the URI passed back to me from that. I checked and verified that the list I just created is on my account when I log in. Is there a delay from when the list is created until it will be recognized in the API?
I also tried changing it to list 1 but that doesn't help either, I get the same 400 bad request.
I am using RESTClient, which you can find more information about at - http://developer.constantcontact.com/doc/restclient. This allows you to test GET PUT POST and DELETE http requests, and returns the response from the server. This is very beneficial for testing your API calls by alleviating any issues that may be caused by the program language you are using, and also allows you to test the response from the server without actually having to modify your program. Using this, I have simply copy and pasted your request without making any modifications, and it successfully created an activity in my account.
With that being said, it seems likely the issue lies outside of the actual string that you are posting to the activities collection. If you would like to send the full program you are using over to our webservices support team, I would be happy to review it and hopefully provide some additional feedback. Please let me know if you have any other questions. Thank you.
I have downloaded the REST client and I still can't get it to work.
I am posting to:
I get this back:
Error 400: Error uploading file
I added the content-type as multipart/form-data
I just changed the content-type to
I guess that was the problem I still don't understand this process it seems to have nothing to do with a file.
I was using the multipart/form-data as per line below copied from documentation.
"when uploading a complete file of data, particularly binary data like MS Excel spreadsheets, you must use a
I think the file would be more efficient, as per this line
"The content type "application/x-www-form-urlencoded" is inefficient for sending large quantities of binary data or text containing non-ASCII characters. The content type "multipart/form-data" should be used for submitting forms that contain files, non-ASCII data, and binary data."
But maybe you don't support it. I guess it works as long as like you said it will upload 20,000 contacts that way.
I noticed that you are also speaking to our AppConnect manager, Dave Berard, in regards to this issue.
He let me know that he will contact you about this directly, so that we can better assist you.