How can i get the SubmitGenerateReport proper Response SOAP

Anand 0 Reputation points
2024-04-08T07:47:05.38+00:00

I'm referring this https://learn.microsoft.com/en-us/answers/questions/1233990/bing-ads-reporting-api-there-is-no-report-data-for
to SubmitGenerateReport
and this is my SOAP Request:
(NOTE: I'm only using the Python request library)

# Define the SOAP request body with placeholders for input values
soap_request_template = """
<s:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header xmlns="https://bingads.microsoft.com/Reporting/v13">
    <Action mustUnderstand="1">SubmitGenerateReport</Action>
    <AuthenticationToken i:nil="false">{authentication_token}</AuthenticationToken>
    <CustomerAccountId i:nil="false">{customer_account_id}</CustomerAccountId>
    <CustomerId i:nil="false">{customer_id}</CustomerId>
    <DeveloperToken i:nil="false">{developer_token}</DeveloperToken>
  </s:Header>
  <s:Body>
    <SubmitGenerateReportRequest xmlns="https://bingads.microsoft.com/Reporting/v13">
      <ReportRequest i:nil="false" i:type="AccountPerformanceReportRequest">
        <ExcludeColumnHeaders i:nil="false">{exclude_column_headers}</ExcludeColumnHeaders>
        <Columns i:nil="false">
          <AccountPerformanceReportColumn>AccountName</AccountPerformanceReportColumn>
          <AccountPerformanceReportColumn>AccountNumber</AccountPerformanceReportColumn>
          <AccountPerformanceReportColumn>AccountId</AccountPerformanceReportColumn>
          <AccountPerformanceReportColumn>TimePeriod</AccountPerformanceReportColumn>
          <AccountPerformanceReportColumn>CurrencyCode</AccountPerformanceReportColumn>
          <AccountPerformanceReportColumn>AdDistribution</AccountPerformanceReportColumn>
          <AccountPerformanceReportColumn>Impressions</AccountPerformanceReportColumn>
          <AccountPerformanceReportColumn>Clicks</AccountPerformanceReportColumn>
          <AccountPerformanceReportColumn>Ctr</AccountPerformanceReportColumn>
          <AccountPerformanceReportColumn>AverageCpc</AccountPerformanceReportColumn>
          <AccountPerformanceReportColumn>Spend</AccountPerformanceReportColumn>
          <AccountPerformanceReportColumn>AveragePosition</AccountPerformanceReportColumn>
          <AccountPerformanceReportColumn>Conversions</AccountPerformanceReportColumn>
          <AccountPerformanceReportColumn>ConversionRate</AccountPerformanceReportColumn>
          <AccountPerformanceReportColumn>CostPerConversion</AccountPerformanceReportColumn>
          <AccountPerformanceReportColumn>LowQualityClicks</AccountPerformanceReportColumn>
          
        </Columns>
        <!-- Other fields with placeholders -->
        <Time i:nil="false">
          <CustomDateRangeEnd i:nil="false">
            <Day>{end_day}</Day>
            <Month>{end_month}</Month>
            <Year>{end_year}</Year>
          </CustomDateRangeEnd>
          <CustomDateRangeStart i:nil="false">
            <Day>{start_day}</Day>
            <Month>{start_month}</Month>
            <Year>{start_year}</Year>
          </CustomDateRangeStart>
          <PredefinedTime i:nil="false">ValueHere</PredefinedTime>
          <ReportTimeZone i:nil="false">ValueHere</ReportTimeZone>
        </Time>
      </ReportRequest>
    </SubmitGenerateReportRequest>
  </s:Body>
</s:Envelope>
"""

# Set the URL endpoint for the SOAP service
url = "https://bingads.microsoft.com/Reporting/v13"
# Set the headers
headers = {
    "Content-Type": "text/xml; charset=utf-8",
}

# Send the SOAP request
response = requests.post(url, data=soap_request, headers=headers)

then it just redirect me towards the Bing ads/microsoft advertising page https://ads.microsoft.com/
so I'm blocked here and I'm not able to go further it just redirects to the login page of https://ads.microsoft.com/.

  <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header xmlns="https://bingads.microsoft.com/Reporting/v13">
    <TrackingId d3p1:nil="false" xmlns:d3p1="http://www.w3.org/2001/XMLSchema-instance">ValueHere</TrackingId>
  </s:Header>
  <s:Body>
    <SubmitGenerateReportResponse xmlns="https://bingads.microsoft.com/Reporting/v13">
      <ReportRequestId d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">ValueHere</ReportRequestId>
    </SubmitGenerateReportResponse>
  </s:Body>
</s:Envelope>
		
    			

So then I want ReportRequestId and TrackingId and then I want to pass these ReportRequestId and TrackingId parameters as input to the PollGenerateReport request SOAP

https://learn.microsoft.com/en-us/advertising/reporting-service/pollgeneratereport?view=bingads-13
so then I want from PollGenerateReport response SOAP so I can get the ReportDownloadUrl then i can able to download the report using that url.

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.
391 questions
Microsoft Advertising
Microsoft Advertising
A platform for Microsoft's advertising efforts designed to manage all advertising and reporting for partner advertisers. Previously known as Bing Ads and adCenter.
54 questions
0 comments No comments
{count} votes