Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter https://bingads.microsoft.com/Reporting/v13:ReportRequest. The InnerException message was 'Invalid enum value '' cannot be deserialized into type 'Microsoft.AdCenter.Advertiser.Reporting.Api.DataContracts.Enum.ReportTimePeriod'. Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute.'. Please see InnerException for more details.' #258

Open
priyansh-think360 opened this issue Oct 27, 2023 · 1 comment

Comments

@priyansh-think360
Copy link

priyansh-think360 commented Oct 27, 2023

I am trying to fetch four reports namely:

  1. Ads performance report
  2. AdGroup performance report
  3. Campaign performance report
  4. Keyword performance report

It is able to successfully fetch the first three, but while fetching the Keyword performance report it gives the following error:

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter https://bingads.microsoft.com/Reporting/v13:ReportRequest. The InnerException message was 'Invalid enum value '' cannot be deserialized into type 'Microsoft.AdCenter.Advertiser.Reporting.Api.DataContracts.Enum.ReportTimePeriod'. Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute.'. Please see InnerException for more details.'

Here is the snippet of the way i defined Time:
aggregation = 'Daily'
exclude_column_headers=False
exclude_report_footer=False
exclude_report_header=False
return_only_complete_data=False

time=reporting_service.factory.create('ReportTime')

time.ReportTimeZone='EasternTimeUSCanada'
time.CustomDateRangeStart.Day = start_time.day   
time.CustomDateRangeStart.Month = start_time.month 
time.CustomDateRangeStart.Year = start_time.year  
time.CustomDateRangeEnd.Day = date.today().day - 1
time.CustomDateRangeEnd.Month = date.today().month
time.CustomDateRangeEnd.Year = date.today().year

if i also give time.PredefinedTime = None, then the code runs but the keyword performance report comes out as null

@qitia
Copy link
Collaborator

qitia commented Nov 6, 2023

can you share the trackingid/requestid? And, can you please try below as example shows:
time=set_elements_to_none(reporting_service.factory.create('ReportTime'))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants