large SV_ADD fails with 12,000 contacts

Regular Participant

large SV_ADD fails with 12,000 contacts

I am trying to do an SV_ADD but it is failing when using a large amount of contacts (12,000). I have read that you allow up to 20,000 but I am well below that and still getting errors. It fails with error "No activityType specified." However, the activity type is right at the beginning of the string. Here is the code I am using to upload the contacts:



public static string bulkUrlEncoded(AuthenticationData authdata, string data, IList<string> listIds)
    if (string.IsNullOrEmpty(data))
        throw new ArgumentException("No data to be uploaded specified.", "data");
    if (listIds.Count == 0)
        throw new ArgumentException("No target list ID(s) Specified.", "listIds");
    string encodeddata = "&data=" + HttpUtility.UrlEncode(data);
    //SV_ADD is add contact, REMOVE_CONTACTS_FROM_LISTS self explanatory. CLEAR_CONTACTS_FROM_LISTS 
    //sent with no data will clear the list.
    int i = 0;
    string JoinedURIs = "";
    for (i = 0; i < listIds.Count; i++)
        JoinedURIs = JoinedURIs + "&lists=" + authdata.AccountContactListsUri + "/" + listIds[i];
    string fullrequest = "activityType=SV_ADD" + encodeddata + JoinedURIs;
    return Utility.urlEncodedPost(authdata, authdata.accountActivitiesUri, fullrequest);

public static string urlEncodedPost(AuthenticationData Authdata, string URI, string content)
    WebResponse response = null;

        // Create a request
        WebRequest request = WebRequest.Create(URI);
        // Set API+UN/PWD Credentials
        request.Credentials = new NetworkCredential(Authdata.AccountUserName, Authdata.Password);
        // Set Method type
        request.Method = "POST";
        // Create POST data and convert it to a byte array.
        string postData = content;
        byte[] byteArray = Encoding.UTF8.GetBytes(postData);
        // Set the ContentType of Request
        request.ContentType = "application/x-www-form-urlencoded";
        // Set the ContentLength
        request.ContentLength = byteArray.Length;
        // Get the request stream.
        Stream dataStream = request.GetRequestStream();
        // Write the data to the request stream.
        dataStream.Write(byteArray, 0, byteArray.Length);
        // Close the Stream object.
        // Get the response.
        response = request.GetResponse();
        // Get the stream containing content returned by the server.
        dataStream = response.GetResponseStream();
        // Open the stream using a StreamReader for easy access.
        StreamReader reader = new StreamReader(dataStream);
        // Read the content.
        string responseFromServer = reader.ReadToEnd();
        // Clean up the streams.
        return (responseFromServer);
    catch (WebException ex)
        StreamReader reader = new StreamReader(ex.Response.GetResponseStream());

        String responseBody = reader.ReadToEnd();
        throw new WebException(responseBody, ex, ex.Status, response);

 I am creating the encodeddata by starting with this:


public string buildTextFileHeader()
    string rec = string.Empty;
    rec += "Email Address,First Name,Last Name,Job Title,Company Name,Work Phone,";
    rec += "Home Phone,Address Line 1,Address Line 2,City,State,Country,Postal Code,";
    rec += "Custom Field 1,Custom Field 2,Custom Field 3,Custom Field 4,Custom Field 5,";
    rec += "Custom Field 6,Custom Field 7,Custom Field 8,Custom Field 9,Custom Field 10,";
    rec += "Custom Field 11,Custom Field 12,Custom Field 13,Custom Field 14,Custom Field 15,";
    rec += "Email Type";

    return rec;

And then adding each contact record, using commas to delimit the fields. We are also only doing one list at a time, so the JoinedURIs only has one “&lists=…” in it.  And I am making sure to enclose any fields that could potentially contain commas in double quotes.


So what could be causing the error?




I am going to try to do a bulk upload with a large file when you send me over the file you're using (to to see if the problem is replicable.  Thanks for helping us troubleshoot the issue.


Best Regards,

Shannon W.

API Support Specialist

Developer Portal

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

Visit Page