Internal server error when uploading to Bing Ads API v13 - Customer List or Customer List Item in

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

I am currently uploading the csv file to the Customer List 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

And then I have also received the url from IBulkService for me to upload the csv file, now 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("application/octet-stream");

        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.

From my perspective the BingAdsAPI V13 Customer List endpoint is having an internal server error. And if I am mistaken, is there any way we can fix it by any means of modification in the code.

Please help.

Microsoft Advertising API
Microsoft Advertising API
A Microsoft API that provides programmatic access to Microsoft Advertising to manage large campaigns or to integrate your marketing with other in-house systems.
452 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Hasmer Salubre 5 Reputation points
    2025-03-10T21:37:41.1233333+00:00

    Hi Guys,

    The application is hosted in windows azure. We develop it in our local environment.

    The Microsoft API that we are having an issue with is the Bing Ads API v13 - Customer List Record and this issue also happens for Customer List Item Record.

    When it comes to authentication, we are able to get the upload URL from IBulkService, and when we used that upload URL to upload our csv file, that's when the response error occurs.

    Regarding the use of multipart/form-data encoding, I have modified the type to application/octet-stream since this is the type for csv files.

    Thank you for all your queries.


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.