Hi there, I am trying to use the new php v5 library to create responsive search ads <https://developers.google.com/google-ads/api/docs/responsive-search-ads/create-responsive-search-ads#java> . I have set the parameters according to the example, But all i get is an error message saying that the field 'ad_group' is missing.
*See attachment for production code and debug log.* This is the run output: """ {\n "message": "Request contains an invalid argument.",\n "code": 3,\n "status": "INVALID_ARGUMENT",\n "details": [\n {\n "@type": "google.ads.googleads.v5.errors.googleadsfailure-bin",\n "data": "<Unknown Binary Data>"\n },\n {\n "@type": "grpc-status-details-bin",\n "data": "<Unknown Binary Data>"\n },\n {\n "@type": "request-id",\n "data": "Cyo_Q4uH8-7UNSiaFsMxyQ"\n }\n ]\n } """ Thanks! -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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/27c4083e-800b-4be5-b823-0e889c81fa2fn%40googlegroups.com.
public function addAd(int $customer_id,int $group_id) { try{ $adGroupResourceName = ResourceNames::forAdGroup($customer_id,$group_id); // Creates the responsive search ad info. $responsiveSearchAdInfo = new ResponsiveSearchAdInfo(); $responsiveSearchAdInfo->setHeadlines([new AdTextAsset(['text'=> 'head1'])]); $responsiveSearchAdInfo->setDescriptions([new AdTextAsset(['text'=> 'desc1'])]); // Builds the final ad group ad representation. $adGroupAd = new AdGroupAd([ 'ad_group' => $adGroupResourceName, 'status' => AdGroupAdStatus::PAUSED, 'ad' => new Ad([ 'final_urls' => ['http://www.example.com'], 'responsive_search_ad' => $responsiveSearchAdInfo ]) ]); // Creates the operation $adGroupAdOperation = new AdGroupAdOperation(); $adGroupAdOperation->setCreate($adGroupAd); // Creates the AdGroupAdServiceClient. $adGroupAdServiceClient = parent::client()->getAdGroupAdServiceClient(); // Adds the AdGroup. $adGroupAdResponse = $adGroupAdServiceClient->mutateAdGroupAds($customer_id,[$adGroupAdOperation]); dd($adGroupAdResponse); }catch (ApiException $e){ dd($e->getMessage()); } }
[2020-10-12T13:40:31.395450+08:00] google-ads.INFO: Request made: Host: "googleads.googleapis.com", Method: "/google.ads.googleads.v5.services.GoogleAdsService/SearchStream", CustomerId: 123456789, RequestId: "abc", IsFault: 0, FaultMessage: "None" [2020-10-12T13:40:31.770966+08:00] google-ads.WARNING: Request made: Host: "googleads.googleapis.com", Method: "/google.ads.googleads.v5.services.AdGroupAdService/MutateAdGroupAds", CustomerId: 123456789, RequestId: "abc", IsFault: 1, FaultMessage: "["Field 'ad_group' is required for 'CREATE' operation."]" [2020-10-12T13:40:31.772382+08:00] google-ads.NOTICE: Request ------- Method Name: /google.ads.googleads.v5.services.AdGroupAdService/MutateAdGroupAds Host: googleads.googleapis.com Headers: { "x-goog-api-client": "gl-php\/7.3.4 gapic\/ gax\/1.4.0 grpc\/1.28.0", "x-goog-request-params": "customer_id=123456789", "developer-token": "abc", "login-customer-id": "123456789" } Request: {"customerId":"123456789","operations":[{"create":{"status":"PAUSED","ad":{"finalUrls":["http:\/\/www.example.com"],"responsiveSearchAd":{"headlines":[{}],"descriptions":[{}]}}}}]} Response ------- Headers: { "request-id": "123456789", "date": "Mon, 12 Oct 2020 05:40:31 GMT", "alt-svc": "h3-Q050=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-27=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-T050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" } Fault ------- Status code: 3 Details: Request contains an invalid argument. Failure: {"errors":[{"errorCode":{"requestError":"REQUIRED_FIELD_MISSING"},"message":"Field 'ad_group' is required for 'CREATE' operation.","location":{"fieldPathElements":[{"fieldName":"operations","index":"0"},{"fieldName":"create"},{"fieldName":"ad_group"}]}}]} [2020-10-12T13:43:12.724700+08:00] google-ads.INFO: Request made: Host: "googleads.googleapis.com", Method: "/google.ads.googleads.v5.services.GoogleAdsService/Search", CustomerId: 123456789, RequestId: "abc", IsFault: 0, FaultMessage: "None" [2020-10-12T13:59:14.276797+08:00] google-ads.INFO: Request made: Host: "googleads.googleapis.com", Method: "/google.ads.googleads.v5.services.GoogleAdsService/Search", CustomerId: 123456789, RequestId: "abc", IsFault: 0, FaultMessage: "None" [2020-10-12T13:59:24.170028+08:00] google-ads.INFO: Request made: Host: "googleads.googleapis.com", Method: "/google.ads.googleads.v5.services.GoogleAdsService/Search", CustomerId: 123456789, RequestId: "abc", IsFault: 0, FaultMessage: "None"