googleads/google-ads-php

bad argument in search method

psobhanlo opened this issue · 6 comments

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

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/token` resulted in a 400 Bad Request response: { "error": "invalid_grant", "error_description": "Bad Request" }`

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

When do you think this problem will be solved?

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

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?

can you share google_ads_php.ini with me for test??
such as sandbox.
with test clientid or secret id o...
for test application??

my domin is link

You can find sample google_ads_php.ini here.

Unfortunately, we don't have test client ID and secret for users to test. You can check this guide for getting started with the Google API console project.
Visit Test accounts for more information about how to create the test accounts.
If you have any questions about the Google Ads API in general, please contact the Google Ads API forum.