Hello Sreenu. Thank you for the reply.
Application Type I am using Google Ads REST API in the Laravel application which is a web app using PHP. In this type of application I cannot asked client to do all these configuration to run the application. What am I supposed to do here? NTS / TS What am I supposed to do after knowing whether my version supports NTS and vice-versa? I am using Laravel artisan server to run my code. What am I supposed to do here? Hoping you understand my issues. Awaiting your reply. Thanks, Amit On Friday, March 27, 2020 at 1:14:00 AM UTC+5:30, sreenu malae wrote: > > Hello Amiti Lahiri, > I faced the same issue BadMethodCallException. > But I solved it by following a few steps > > 1. In terminal execute this "php -i" and check whether your version > supports NTS(Non Thread Safe) or TS(thread-safe) > 2. Then download compatible grpc dll from pecl site. Place the dll > file in php/ext and C:\Windows\System32. > 3. In C:\Windows\System32 place php7.dll(In my case im using php7) and > in php.ini place extension=grpc > 4. Now restart > > Note: step one is mandatory. you need to verify it supports NTS or TS > Hope it will work. > > On Thursday, March 26, 2020 at 11:14:47 PM UTC+4, Amit Lahiri wrote: >> >> Hi Bryan. >> >> I am adding to the last post. >> >> Error is generating from the below line of code, following the error >> given. >> *$stream = $googleAdsServiceClient->searchStream($customerId, $query);* >> >> *BadMethodCallException* >> *Streaming calls are not supported while using the REST transport.* >> >> I cannot locate the function searchStream() in the library I am using for >> gRPC. I have tried with the libraries grpc and grpc-gcp, from >> packagist.org. >> What am I supposed to do now? >> >> Awaiting your reply. >> >> >> Thanks, >> Amit >> >> >> >> >> >> On Thursday, March 26, 2020 at 1:36:21 AM UTC+5:30, Amit Lahiri wrote: >>> >>> Hi Bryan. >>> >>> Thanks a lot for the reply one again. >>> >>> >>> *1. REST transport: here is the code. * >>> >>> public function profile() >>> { >>> // Either pass the required parameters for this example on the >>> command line, or insert them into the constants above. >>> $options = (new ArgumentParser())->parseCommandArguments([ >>> ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT >>> ]); >>> >>> // Generate a refreshable OAuth2 credential for authentication. >>> $oAuth2Credential = (new OAuth2TokenBuilder()) >>> ->withClientId('XXXXXX......') >>> ->withClientSecret('XXXXXX......') >>> ->withRefreshToken('XXXXXX......') >>> ->build(); >>> >>> // Construct a Google Ads client configured from a properties >>> file and the OAuth2 credentials above. >>> $googleAdsClient = (new GoogleAdsClientBuilder()) >>> ->withOAuth2Credential($oAuth2Credential) >>> ->withDeveloperToken('XXXXXX......') >>> ->withLoginCustomerId('1234567890') >>> ->build(); >>> >>> try { >>> self::runExample( >>> $googleAdsClient, >>> $options[ArgumentNames::CUSTOMER_ID] ?: self::CUSTOMER_ID >>> ); >>> } catch (GoogleAdsException $googleAdsException) { >>> echo '<pre>'; >>> printf( >>> "Request with ID '%s' has failed.%sGoogle Ads failure >>> details:%s", >>> $googleAdsException->getRequestId(), >>> PHP_EOL, >>> PHP_EOL >>> ); >>> foreach >>> ($googleAdsException->getGoogleAdsFailure()->getErrors() as $error) { >>> /** @var GoogleAdsError $error */ >>> printf( >>> "\t%s: %s%s", >>> $error->getErrorCode()->getErrorCode(), >>> $error->getMessage(), >>> PHP_EOL >>> ); >>> } >>> } catch (ApiException $apiException) { >>> echo '<pre>'; >>> printf( >>> "ApiException was thrown with message '%s'.%s", >>> $apiException->getMessage(), >>> PHP_EOL >>> ); >>> } >>> } >>> >>> public static function runExample(GoogleAdsClient $googleAdsClient, >>> int $customerId) >>> { >>> $googleAdsServiceClient = >>> $googleAdsClient->getGoogleAdsServiceClient(); >>> >>> // Creates a query that retrieves all campaigns. >>> $query = 'SELECT campaign.id, campaign.name FROM campaign ORDER >>> BY campaign.id'; >>> >>> // Issues a search stream request. >>> /** @var GoogleAdsServerStreamDecorator $stream */ >>> $stream = $googleAdsServiceClient->searchStream($customerId, >>> $query); >>> >>> // Iterates over all rows in all messages and prints the >>> requested field values for >>> // the campaign in each row. >>> foreach ($stream->readAll() as $response) { >>> /** @var SearchGoogleAdsStreamResponse $response */ >>> foreach ($response->getResults() as $googleAdsRow) { >>> /** @var GoogleAdsRow $googleAdsRow */ >>> printf( >>> "Campaign with ID %d and name '%s' was found.%s", >>> $googleAdsRow->getCampaign()->getId()->getValue(), >>> $googleAdsRow->getCampaign()->getName()->getValue(), >>> PHP_EOL >>> ); >>> } >>> } >>> } >>> >>> >>> *2. Customer Id issue: * >>> I am using CUSTOMER_ID to retrieve the data from table campaign. Where >>> do I find the table lists and their corresponding use? >>> In the code above, there is a constant CUSTOMER_ID. I wish to make this >>> constant value dynamic after successful log in, means user will get the >>> customer id / ids to choose from once log in successfully. >>> >>> *Common question:* >>> Is there anyway I can call Google Ads API using REST, such as, >>> $response = file_get_contents(" >>> https://ads.google.com/api/v3/?param1=val1........."); >>> print_r($response); >>> >>> Awaiting your reply. >>> >>> >>> Thanks, >>> Amit >>> >>> >>> >>> >>> On Thursday, March 26, 2020 at 1:14:25 AM UTC+5:30, adsapiforumadvisor >>> wrote: >>>> >>>> Hi Amit, >>>> >>>> I see you have two queries. You will find my answers below. >>>> >>>> 1. Issue with REST Transport. >>>> Could you provide the REST request and response logs where this error >>>> occurs so that I may further investigate this issue? >>>> >>>> 2. How to obtain Customer_ID dynamically. >>>> Could you clarify what you're using the customer_ID for? Are you trying >>>> to query for a list of customer_IDs? If so, you can use the Customer >>>> Report >>>> to pull customer.id >>>> <https://developers.google.com/google-ads/api/fields/v3/customer#customer.id> >>>> under >>>> the manager account. >>>> >>>> Let me know if you have further questions. >>>> >>>> Thank you, >>>> Bryan, Google Ads API Team >>>> >>>> ref:_00D1U1174p._5001UXVi3P:ref >>>> >>> -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog: https://googleadsdeveloper.blogspot.com/ =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en --- You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/9eb5c368-20ae-49ac-b634-0f05375c1749%40googlegroups.com.