Search code examples
rubysoapadssavonbing-ads-api

NoMeasureSelected CampaignPerformanceReportRequest Microsoft Ads


I'm trying to setup Microsoft ads to a project and get CampaignPerformanceReportRequest working on my project but I'm receiving NoMeasureSelected error. Not sure where the issue is. I added all the columns mention in the documentation to see if the work, but still getting same error. I tested using add dashboard report. It only require Impression and TimePeriod to generate successful report. I make my request to match the request in dashboard, but still get the same error.

Project is based on Ruby on rails.

  <env:Body>
    <v13:SubmitGenerateReportRequest xmlns="https://bingads.microsoft.com/Reporting/v13">
      <v13:ReportRequest xsi:type="CampaignPerformanceReportRequest">
        <v13:ExcludeColumnHeaders>true</v13:ExcludeColumnHeaders>
        <v13:ExcludeReportFooter>true</v13:ExcludeReportFooter>
        <v13:ExcludeReportHeader>true</v13:ExcludeReportHeader>
        <v13:Format>Csv</v13:Format>
        <v13:ReportName>Test Report</v13:ReportName>
        <v13:ReturnOnlyCompleteData>false</v13:ReturnOnlyCompleteData>
        <v13:Aggregation>Summary</v13:Aggregation>
        <v13:Columns>
          <v13:CampaignPerformanceReportColumn>AccountId</v13:CampaignPerformanceReportColumn>
        </v13:Columns>
        <v13:Columns>
          <v13:CampaignPerformanceReportColumn>CampaignId</v13:CampaignPerformanceReportColumn>
        </v13:Columns>
        <v13:Columns>
          <v13:CampaignPerformanceReportColumn>Keyword</v13:CampaignPerformanceReportColumn>
        </v13:Columns>
        <v13:Columns>
          <v13:CampaignPerformanceReportColumn>KeywordId</v13:CampaignPerformanceReportColumn>
        </v13:Columns>
        <v13:Columns>
          <v13:CampaignPerformanceReportColumn>DeviceType</v13:CampaignPerformanceReportColumn>
        </v13:Columns>
        <v13:Columns>
          <v13:CampaignPerformanceReportColumn>Clicks</v13:CampaignPerformanceReportColumn>
        </v13:Columns>
        <v13:Filter xsi:nil="true"/>
        <v13:Scope>
          <v13:AccountIds xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:long>[REDACTED]</a1:long>
          </v13:AccountIds>
        </v13:Scope>
        <v13:Time>
          <v13:CustomDateRangeEnd>
            <v13:Day>30</v13:Day>
            <v13:Month>04</v13:Month>
            <v13:Year>2022</v13:Year>
          </v13:CustomDateRangeEnd>
          <v13:CustomDateRangeStart>
            <v13:Day>01</v13:Day>
            <v13:Month>04</v13:Month>
            <v13:Year>2022</v13:Year>
          </v13:CustomDateRangeStart>
        </v13:Time>
      </v13:ReportRequest>
    </v13:SubmitGenerateReportRequest>
  </env:Body>

Response:

  <s:Body>
    <s:Fault>
      <faultcode>s:Server</faultcode>
      <faultstring>Invalid client data. Check the SOAP fault details for more information. TrackingId: 96ad1b6d-26e2-4b60-91d0-b6a68add6140.</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">96ad1b6d-26e2-4b60-91d0-b6a68add6140</TrackingId>
          <BatchErrors/>
          <OperationErrors>
            <OperationError>
              <Code>2017</Code>
              <Details i:nil="true"/>
              <ErrorCode>NoMeasureSelected</ErrorCode>
              <Message>The specified report request does not specify measurement columns (at least one is required). 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>

Does any one know what is the issue here or any one has working SOAP request ?


Solution

  • Looks like your structure around Columns isn't quite right.

    I think what the error The specified report request does not specify measurement columns (at least one is required). 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. refers to is that Columns should have multiple values (i.e. be an 'array') - not itself be repeated like in your example.

    I infer this from the reference documentation where Columns is defined with type ArrayOfCampaignPerformanceReportColumn.

    <xs:element name="Columns" nillable="true" type="tns:ArrayOfCampaignPerformanceReportColumn" />
    

    For your example, something like this should work:

    <env:Body>
    <v13:SubmitGenerateReportRequest xmlns="https://bingads.microsoft.com/Reporting/v13">
      <v13:ReportRequest xsi:type="CampaignPerformanceReportRequest">
        <v13:ExcludeColumnHeaders>true</v13:ExcludeColumnHeaders>
        <v13:ExcludeReportFooter>true</v13:ExcludeReportFooter>
        <v13:ExcludeReportHeader>true</v13:ExcludeReportHeader>
        <v13:Format>Csv</v13:Format>
        <v13:ReportName>Test Report</v13:ReportName>
        <v13:ReturnOnlyCompleteData>false</v13:ReturnOnlyCompleteData>
        <v13:Aggregation>Summary</v13:Aggregation>
        <v13:Columns>
          <v13:CampaignPerformanceReportColumn>AccountId</v13:CampaignPerformanceReportColumn>
          <v13:CampaignPerformanceReportColumn>CampaignId</v13:CampaignPerformanceReportColumn>
          <v13:CampaignPerformanceReportColumn>Keyword</v13:CampaignPerformanceReportColumn
          <v13:CampaignPerformanceReportColumn>KeywordId</v13:CampaignPerformanceReportColumn>
          <v13:CampaignPerformanceReportColumn>DeviceType</v13:CampaignPerformanceReportColumn
          <v13:CampaignPerformanceReportColumn>Clicks</v13:CampaignPerformanceReportColumn>
        </v13:Columns>
        <v13:Filter xsi:nil="true"/>
        <v13:Scope>
          <v13:AccountIds xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:long>[REDACTED]</a1:long>
          </v13:AccountIds>
        </v13:Scope>
        <v13:Time>
          <v13:CustomDateRangeEnd>
            <v13:Day>30</v13:Day>
            <v13:Month>04</v13:Month>
            <v13:Year>2022</v13:Year>
          </v13:CustomDateRangeEnd>
          <v13:CustomDateRangeStart>
            <v13:Day>01</v13:Day>
            <v13:Month>04</v13:Month>
            <v13:Year>2022</v13:Year>
          </v13:CustomDateRangeStart>
        </v13:Time>
      </v13:ReportRequest>
    </v13:SubmitGenerateReportRequest>
    </env:Body>