googleads / google-ads-php

Google Ads API Client Library for PHP
https://developers.google.com/google-ads/api/docs/client-libs/php
Apache License 2.0
280 stars 260 forks source link

bad argument in search method #1036

Closed psobhanlo closed 3 days ago

psobhanlo commented 1 month ago

hi . i am clone form git LARAVEL EXAMPLE project and config ini file and install vendor package.

everything well ok. but when i do report for the specified customer ID
i exception in my app

TypeError
Google\Ads\GoogleAds\V17\Services\Client\GoogleAdsServiceClient::search(): Argument #1 ($request) must be of type Google\Ads\GoogleAds\V17\Services\SearchGoogleAdsRequest, string given, called in /../google-ads-php/examples/LaravelSampleApp/app/Http/Controllers/GoogleAdsApiController.php on line 149
psobhanlo commented 1 month ago

please change method search . for first params

SearchGoogleAdsRequest::build($customerId, $query)

     $response = $googleAdsClient->getGoogleAdsServiceClient()->search(
            SearchGoogleAdsRequest::build($customerId, $query)
,
            [
                'pageSize' => $entriesPerPage,
                // Requests to return the total results count. This is necessary to
                // determine how many pages of results exist.
                'returnTotalResultsCount' => true,
                // The page token of the requested page is in the page token list because of the
                // processing done in the previous loop.
                'pageToken' => $pageTokens[$pageNo - 1]
            ]
        );

after change code err auth 400

Client error:POST https://oauth2.googleapis.com/tokenresulted in a400 Bad Requestresponse: { "error": "invalid_grant", "error_description": "Bad Request" }

fiboknacky commented 1 month ago

Thanks for reporting. Will take a look as soon as I have bandwidth.

psobhanlo commented 1 day ago

When do you think this problem will be solved?

Can you describe the problem so that I can solve it myself

fiboknacky commented 1 day ago

I thought you could resolve this as you closed it already. From the error, it looks like you have a problem with configuring the OAuth tokens, could you post on the Google Ads API forum and share your request and response logs?