forward3d / bing-ads-reporting

Gem for pulling reports from bing ads
MIT License
10 stars 14 forks source link

Keyword Performance Report does not seem to work #7

Open zben opened 5 years ago

zben commented 5 years ago

Keep getting error from the server. Did you verify that you can get keyword performance report using the code on the home page without issue for bing ads v12? Thanks!!

Error

E, [2019-01-02T02:44:40.490002 #12749] ERROR -- : (a:InternalServiceFault) The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.
E, [2019-01-02T02:44:40.490111 #12749] ERROR -- : unexpected error
Savon::SOAPFault: (a:InternalServiceFault) The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.
from /Users/benz/.rvm/gems/ruby-2.3.1/gems/savon-2.11.1/lib/savon/response.rb:85:in `raise_soap_and_http_errors!'

Note

application_token is not needed from Bing API documentation so I used nil value for it. https://docs.microsoft.com/en-us/bingads/guides/get-started?view=bingads-12#request-headers

Sample code

Here is the code I was running, assuming the home page code is correct

developer_token =  <VALUE>
authentication_token = <VALUE> 
account_id = <VALUE>
customer_id = <VALUE>

service = BingAdsReporting::AdInsightService.new({developerToken:
developer_token,
applicationToken: nil, authenticationToken: authentication_token, accountId: account_id, customerId:
customer_id})

period = Datebox::Period.new('2018-07-01', '2018-07-03')
    id = service.generate_report({report_type: 'KeywordPerformance',
                                  report_format: 'Tsv',
                                  aggregation: 'Daily',
                                  aggregation_period: 'ReportAggregation::Daily',
                                  columns: %w[AccountId AccountName CampaignId CampaignName AdGroupId AdGroupName KeywordId Keyword DestinationUrl DeliveredMatchType AverageCpc CurrentMaxCpc AdDistribution CurrencyCode Impressions Clicks Ctr CostPerConversion Spend AveragePosition TimePeriod CampaignStatus AdGroupStatus DeviceType]},
                                  {period: period})