BingAds / BingAds-Python-SDK

Other
117 stars 163 forks source link

ReportRequest invalid enum value '' #64

Closed pocin closed 7 years ago

pocin commented 7 years ago

I keep getting

E                       suds.WebFault: Server raised fault: '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/v11: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.'

when trying to download AdPerformanceReport (this is a sandbox call).

this is (an excerpt of what I believe are relevant parts) of my request


   Aggregation = "Daily"
   Columns =
      (ArrayOfAdPerformanceReportColumn){
         AdPerformanceReportColumn[] =

            "AccountName",
... shortened for clarity
            "Path1",
            "Path2",,
      }
   Filter =
      (AdPerformanceReportFilter){
         AccountStatus = None
         AdDistribution = None
         AdGroupStatus = None
         AdStatus = None
         AdType = None
         CampaignStatus = None
         DeviceType = None
         LanguageCode =
            (ArrayOfstring){
               string[] = <empty>
            }
      }
   Scope =
      (AccountThroughAdGroupReportScope){
         AccountIds =
            {
               long[] =
                  None,
            }
         AdGroups = None
         Campaigns = None
      }
   Time =
      (ReportTime){
         CustomDateRangeEnd =
            (Date){
               Day = 11
               Month = 10
               Year = 2017
            }
         CustomDateRangeStart =
            (Date){
               Day = 10
               Month = 10
               Year = 2017
            }
         PredefinedTime =
            (ReportTimePeriod){
               value = None
            }
      }
 }

I think the problem is that PredefinedTime is appended to the request despite CustomDateRangeStart/End is set. Could that be a problem?

When I submit requests specifying only PredefinedTime, it works ok

pocin commented 7 years ago

ok, the issue is that you have to explicitly set

report_time.PredefinedTime=None

https://social.msdn.microsoft.com/Forums/en-US/43b1441b-b01c-4613-bfee-ef9064dc2abc/invalid-enum-value-cannot-be-deserialized-into-type?forum=BingAds