0

I'm trying to pull some data from the Bing Ads API but I keep getting error code 2015. I'm using Savon with Ruby on Rails. Here is the request:

<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="https://bingads.microsoft.com/Reporting/v13" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns="https://bingads.microsoft.com/Reporting/v13">
  <env:Header>
    <AuthenticationToken>blahblahblah</AuthenticationToken>
    <CustomerAccountId>blahblahblah</CustomerAccountId>
    <CustomerId>blahblahblah</CustomerId>
    <DeveloperToken>blahblahblah</DeveloperToken>
  </env:Header>
  <env:Body>
    <tns:SubmitGenerateReportRequest>
      <ReportRequest xsi:nil="false" xsi:type="AccountPerformanceReportRequest">
        <ExcludeColumnHeaders>true</ExcludeColumnHeaders>
        <ExcludeReportFooter>true</ExcludeReportFooter>
        <ExcludeReportHeader>true</ExcludeReportHeader>
        <Format>Csv</Format>
        <Language>English</Language>
        <ReportName>AccountPerformanceReportRequest</ReportName>
        <ReturnOnlyCompleteData>false</ReturnOnlyCompleteData>
        <Aggregation>Summary</Aggregation>
        <Columns>
          <AccountPerformanceReportColumn>Spend</AccountPerformanceReportColumn>
          <AccountPerformanceReportColumn>Clicks</AccountPerformanceReportColumn>
          <AccountPerformanceReportColumn>Conversions</AccountPerformanceReportColumn>
          <AccountPerformanceReportColumn>Revenue</AccountPerformanceReportColumn>
        </Columns>
        <Filter xsi:nil="true"/>
        <Scope>
          <AccountIds xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:long>blahblahblah</a1:long>
          </AccountIds>
        </Scope>
        <Time>
          <CustomDateRangeEnd>
            <Day>02</Day>
            <Month>04</Month>
            <Year>2019</Year>
          </CustomDateRangeEnd>
          <CustomDateRangeStart>
            <Day>01</Day>
            <Month>04</Month>
            <Year>2019</Year>
          </CustomDateRangeStart>
          <PredefinedTime xsi:nil="true"/>
          <ReportTimeZone>EasternTimeUSCanada</ReportTimeZone>
        </Time>
      </ReportRequest>
    </tns:SubmitGenerateReportRequest>
  </env:Body>
</env:Envelope>

As you can see, I'm pulling the report with 'Summary' as the aggregation type. If I use 'Monthly' as the aggregation type and include a 'TimePeriod' column, it works perfectly, but if I do that then the data returned is for the whole month of April as opposed to the date range I've selected 04-01-2019..04-02-2019.

Here is the response:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
    <s:Fault>
      <faultcode>s:Server</faultcode>
      <faultstring xml:lang="en-US">Invalid client data. Check the SOAP fault details for more information</faultstring>      <detail>
        <ApiFaultDetail xmlns="https://bingads.microsoft.com/Reporting/v13" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
          <TrackingId xmlns="https://adapi.microsoft.com">52665fe5-3eb8-42e0-ad8e-942e848297ce</TrackingId>
          <BatchErrors/>
          <OperationErrors>
            <OperationError>
              <Code>2015</Code>
              <Details>No Dimension selected.</Details>
              <ErrorCode>RequiredColumnsNotSelected</ErrorCode>
              <Message>The specified report request does not specify all the required columns for this report type. Please submit a report request with the required columns for this report type, and optionally additional columns that are to be included in the report.</Message>
            </OperationError>
          </OperationErrors>
        </ApiFaultDetail>
      </detail>
    </s:Fault>
  </s:Body>
</s:Envelope>

The error code returned would lead me to believe that a TimePeriod column is required even for Summary, but that contradicts what is documented here.

All other aggregation types work with this setup. Any help would be greatly appreciated.

Jordan Lagan
  • 222
  • 2
  • 13

1 Answers1

3

Good catch. We will update documentation to clarify that at least one attribute (non performance stat) e.g., AccountId must be included. Most of the other reports have specific attributes that must be included, whereas the account report does not. I hope this helps!

Eric Urban
  • 582
  • 2
  • 7
  • +1 for Microsoft a) actually helping in a timely fashion; b) admitting fault; c) trolling StackOverflow in an attempt to be more supportive to its community. It may be just you but it is great to see that someone over there cares about an end user. – engineersmnky May 08 '19 at 20:19
  • @engineersmnky I think the word you were looking for is "trawling", not the other tr-word. – Yunnosch May 08 '19 at 20:34
  • @yunnosch trolling *verb* carefully and systematically search an area for something. – engineersmnky May 08 '19 at 21:35
  • Thank you so much! I was scratching my head for a while with that one. Adding AccountId fixed my issue. – Jordan Lagan May 09 '19 at 12:18