Unable to update the headlines of a responsive search ad and vague error reporting
Closed this issue · 0 comments
aromaldev commented
Hi,
Thank you for creating a Golang SDK for Google ads API!
We want to implement a feature to update the headlines of a responsive search ad.
`
headlines := requestBody.Headlines
var headlineAssets []*common.AdTextAsset
for _, headline := range headlines {
newHeadline := headline
adTextAsset := &common.AdTextAsset{
Text: &newHeadline,
}
headlineAssets = append(headlineAssets, adTextAsset)
}
var descriptionAssets []*common.AdTextAsset
for _, description := range descriptions {
newDescription := description
adTextAsset := &common.AdTextAsset{
Text: &newDescription,
}
descriptionAssets = append(descriptionAssets, adTextAsset)
}
// path := "shop"
adGroupAdOperation := &servicespb.AdGroupAdOperation{
Operation: &servicespb.AdGroupAdOperation_Update{
Update: &resources.AdGroupAd{
ResourceName: googleAdsDataModel.ResourceName,
Ad: &resources.Ad{
ResourceName: resourceName,
AdData: &resources.Ad_ResponsiveSearchAd{
ResponsiveSearchAd: &common.ResponsiveSearchAdInfo{
Headlines: headlineAssets,
},
},
},
},
},
UpdateMask: &fieldmaskpb.FieldMask{
Paths: []string{
"ad.responsive_search_ad.headlines",
},
},
}
adGroupAdClient := servicespb.NewAdGroupAdServiceClient(conn)
mutateAdGroupAdRequest := &servicespb.MutateAdGroupAdsRequest{
CustomerId: googleAdsDataModel.CustomerId,
Operations: []*servicespb.AdGroupAdOperation{
adGroupAdOperation,
},
}
mutateAdGroupAdResponse, err := adGroupAdClient.MutateAdGroupAds(ctx, mutateAdGroupAdRequest)
`
We are getting error response
rpc error: code = InvalidArgument desc = Request contains an invalid argument.
All the functions are returning similar errors. Errors specified in the documentation are not thrown.
Kindly help.
Thanks & Regards,
Aromal S