BingAds / BingAds-PHP-SDK

Other
56 stars 45 forks source link

CustomDateRangeStart error #194

Open janiskelemen opened 10 months ago

janiskelemen commented 10 months ago

Hi,

I'm getting an error when I use the CustomDateRangeStart and CustomDateRangeEnd properties.

Fault Code: a:DeserializationFailed Fault String: 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 'Error in line 2 position 4777. 'EndElement' 'CustomDateRangeStart' from namespace 'https://bingads.microsoft.com/Reporting/v13' is not expected. Expecting element 'Day'.'. Please see InnerException for more details. Fault Detail:

        $report = new AdGroupPerformanceReportRequest();

        $report->Format = ReportFormat::Csv;
        $report->ReportName = 'Ad Group Performance Report';
        $report->ReturnOnlyCompleteData = false;
        $report->Aggregation = ReportAggregation::Daily;

        $report->Scope = new AccountThroughAdGroupReportScope();
        if(!empty($campaigns) && $campaigns[0]['CampaignId'] != null) {
            $report->Scope->Campaigns = $campaigns;
        } else {
            $report->Scope->AccountIds = $accountIds;
        }

        $report->Time = new ReportTime();
        $report->Time->ReportTimeZone = 'AmsterdamBerlinBernRomeStockholmVienna';
         $date = new Date();
         $date->Day = 7;
         $date->Month = 11;
         $date->Year = 2023;
         $report->Time->CustomDateRangeStart = $date;
         $report->Time->CustomDateRangeEnd = $date;

        .......