Internal server error when uploading Customer List or Customer List Item.

Hasmer Salubre 5 Reputation points
2025-03-06T20:51:05.4366667+00:00

I am currently uploading the csv file with the contents below

Type,Status,Id,Parent Id,Client Id,Modified Time,Name,Description,Scope,Audience,Action Type

Format Version,,,,,,6.0,,,,,,

Customer List,Active,-1,,af32d10b-7e30-b9e3-3384-3a187e3a3d40,CCYY-03-DDT11:22:52,New Dealerverse Name,New Customer List Dealerverse Description,Customer,New Customer List,Add

I have received the url from IBulkService please check the code below

var bulkService = new ServiceClient

var request = new GetBulkUploadUrlRequest()

{

    AccountId = long.Parse(customerId),

    ResponseMode = ResponseMode.ErrorsAndResults,

};

var response = await bulkService.CallAsync((s, r) => s.GetBulkUploadUrlAsync(r), request);

string uploadUrl = response.UploadUrl;

using (var httpClient = new HttpClient())

{

    using (var fileStream = new FileStream(csvFilePath, FileMode.Open, FileAccess.Read))

    using (var content = new StreamContent(fileStream))

    {

        content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("text/plain");

        HttpResponseMessage uploadResponse = await httpClient.PostAsync(response.UploadUrl, content);

        if (uploadResponse.IsSuccessStatusCode)

        {

            Console.WriteLine("Bulk file uploaded successfully.");

        }

        else

        {

            Console.WriteLine($"Upload failed. Status Code: {uploadResponse.StatusCode}");

            string errorDetails = await uploadResponse.Content.ReadAsStringAsync();

            Console.WriteLine($"Error Details: {errorDetails}");

            return false;

        }

    }

}

The problem is in this line HttpResponseMessage uploadResponse = await httpClient.PostAsync(response.UploadUrl, content);

The response is IsSuccessStatusCode = false And when you look at the response error details it shows Internal Server Error.

Please help.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,333 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.