PHP SOAP Запрос API Bing Ads - PullRequest
       30

PHP SOAP Запрос API Bing Ads

0 голосов
/ 10 марта 2020

Мне трудно понять, как правильно кодировать последовательность SOAP запросов в API Bing Ads. Предпочитаю не использовать их SDK, который я использовал в прошлом.

Параметры 'Scope', 'Time', 'Filter' и 'Sort' не влияют на результат. Вместо этого возвращаются все ключевые слова аккаунта. В поле «Область действия» я использую параметр «Группы объявлений» для выбора ключевых слов в этой группе объявлений. Любая помощь приветствуется.

Ссылка: https://docs.microsoft.com/en-us/advertising/reporting-service/keywordperformancereportrequest?view=bingads-13

WSDL: https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/V13/ReportingService.svc?singleWsdl

        $request = [
        'ReportRequest' => new SoapVar(
        [
            'Format' => 'Csv',
            'ReportName' => 'Bing Keyword Performance Report',
            'ReturnOnlyCompleteData' => false,
            'Aggregation' => 'Daily',
            'Sort' => array('SortColumn' => 'Clicks','SortOrder' => 'Ascending'),
            'Scope' =>  ['AdGroups'  => array(array('AccountId' => $bClientId,
            'AdGroupId' => $apiDBIdGroupBing,
            'CampaignId' => $apiDBIdCampaignBing,
            ))],
            'Time' => [
                'CustomDateRangeStart' => 
                array('Day' => $startDay,'Month' => $startMonth,'Year' => $startYear),
                'CustomDateRangeEnd' => 
                array('Day' => $endDay,'Month' => $endMonth,'Year' => $endYear)
                ],
            'Filter' => ['Keywords' => array($criteriaValue)],
            'Columns' => [
                  "TimePeriod",
                  "Spend",
                  "Clicks",
                  "CurrentMaxCpc",
                  "Impressions",
                  "AdGroupName"
            ]
        ],
        SOAP_ENC_OBJECT,
        'KeywordPerformanceReportRequest',
         "https://bingads.microsoft.com/Reporting/v13"
    )];

1 Ответ

0 голосов
/ 27 марта 2020

Решено:

            $request = [
        'ReportRequest' => new SoapVar(
        [
            'Format' => 'Csv',
            'ReportName' => 'Bing Keyword Performance Report',
            'ReturnOnlyCompleteData' => false,
            'Aggregation' => 'Monthly',
            'Sort' => array('SortColumn' => 'Clicks','SortOrder' => 'Ascending'),
            'Scope' => ['AccountIds' => [$bClientId]],
            'MaxRows' => '9000000',
            'Time' => ['PredefinedTime' => $reportTimeFrame],
            'Columns' => [
                "Keyword",
                "Spend",
                "CampaignId",
                "AdGroupId",
                "AveragePosition",
                "CurrentMaxCpc",
                "KeywordId",
                "BidMatchType",
                "Impressions",
                "Clicks",
                "TimePeriod",
                "QualityScore",
                "ExpectedCtr",
                "AdRelevance",
                "LandingPageExperience",
                "CampaignStatus",
                "AdGroupStatus",
                "KeywordStatus",
                "AccountName",
                "CampaignName",
                "AdGroupName",
                "BidStrategyType",
            ]
        ],
        SOAP_ENC_OBJECT,
        'KeywordPerformanceReportRequest',
         "https://bingads.microsoft.com/Reporting/v13"
        )];

        $response = $SoapClient->SubmitGenerateReport($request);
...