Targeting ads to specific user segments based on demographics, interests, or behavior
Thank you.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am currently uploading the csv 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
to the given url from IBulkService the code is 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.
Targeting ads to specific user segments based on demographics, interests, or behavior
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Thank you.
Hi Hasmer,
We recommend that you ask your API question at the API Development Forum. In that forum you will find our API development engineers and partners who work with our APIs every day.
For immediate assistance with API, you are always welcome to contact support directly.
Thank you,
Shaynne | Microsoft Advertising Support Specialist | 800-518-5689