googleads / google-ads-dotnet

This project hosts the .NET client library for the Google Ads API.
https://developers.google.com/google-ads/api
Apache License 2.0
74 stars 97 forks source link

Api behavior change once we switch package version #229

Closed zgf closed 4 years ago

zgf commented 4 years ago

Which version of the client library are you using? 2.9 and 4.0.0 Which version of .NET are you using? .net core 3.1 Which operating system (Linux, Windows, ...) and version? Windows Actions taken Please provide a code snippet or steps to consistently reproduce the experienced behavior. ecently, we are going to upgrade our nuget package version from 2.9 to 4.0.0 but we hit some behavior change after change the version number in nuget.config. For exmaple, For this API: V2.Service.MutateAdGroupAdsAsync

the inputs is: [{"UpdateMask":null,"PolicyValidationParameter":null,"Create":{"ResourceName":"","Status":2,"AdGroup":"customers/6360593950/adGroups/109644398391","Ad":{"ResourceName":"","Id":null,"FinalUrls":["http://www.bing.com"],"FinalAppUrls":[],"FinalMobileUrls":[],"TrackingUrlTemplate":null,"FinalUrlSuffix":null,"UrlCustomParameters":[],"DisplayUrl":null,"Type":0,"AddedByGoogleAds":null,"DevicePreference":0,"UrlCollections":[],"Name":null,"SystemManagedResourceSource":0,"TextAd":null,"ExpandedTextAd":{"HeadlinePart1":"!!This is a text title","HeadlinePart2":"Ad0 Test TitlePart2","HeadlinePart3":"Ad0 Test TitlePart3","Description":"This is a test text","Description2":"Ad0 Test TextPart2","Path1":"Ad0 Test Path1","Path2":"Ad0 Test Path2"},"CallOnlyAd":null,"ExpandedDynamicSearchAd":null,"HotelAd":null,"ShoppingSmartAd":null,"ShoppingProductAd":null,"GmailAd":null,"ImageAd":null,"VideoAd":null,"ResponsiveSearchAd":null,"LegacyResponsiveDisplayAd":null,"AppAd":null,"LegacyAppInstallAd":null,"ResponsiveDisplayAd":null,"DisplayUploadAd":null,"AppEngagementAd":null,"ShoppingComparisonListingAd":null,"AdDataCase":7},"PolicySummary":null,"AdStrength":0},"Update":null,"Remove":"","OperationCase":1}]

The behavior in previous nuget: it will return response to us with PartialErrors. "{"PartialFailureError":{"Code":3,"Message":"The resource has been disapproved since the policy summary includes policy topics of type PROHIBITED., at operations[0].create.ad.expanded_text_ad","Details":[{"TypeUrl":"type.googleapis.com/google.ads.googleads.v2.errors.GoogleAdsFailure","Value":[10,251,1,10,3,160,4,2,18,101,84,104,101,32,114,101,115,111,117,114,99,101,32,104,97,115,32,98,101,101,110,32,100,105,115,97,112,112,114,111,118,101,100,32,115,105,110,99,101,32,116,104,101,32,112,111,108,105,99,121,32,115,117,109,109,97,114,121,32,105,110,99,108,117,100,101,115,32,112,111,108,105,99,121,32,116,111,112,105,99,115,32,111,102,32,116,121,112,101,32,80,82,79,72,73,66,73,84,69,68,46,26,2,42,0,34,52,18,14,10,10,111,112,101,114,97,116,105,111,110,115,18,0,18,8,10,6,99,114,101,97,116,101,18,4,10,2,97,100,18,18,10,16,101,120,112,97,110,100,101,100,95,116,101,120,116,95,97,100,42,83,26,81,10,37,10,9,10,7,83,89,77,66,79,76,83,16,2,26,8,34,6,10,4,10,2,33,33,26,12,34,10,10,8,10,6,33,33,84,104,105,115,10,40,10,22,10,20,85,78,65,67,67,69,80,84,65,66,76,69,95,83,80,65,67,73,78,71,16,2,26,12,34,10,10,8,10,6,33,33,84,104,105,115]}]},"Results":[{"ResourceName":""}],"PartialFailure":{"Errors":[{"CombinedFieldPath":"operations[0].create.ad.expanded_text_ad","ErrorCode":{"RequestError":0,"BiddingStrategyError":0,"UrlFieldError":0,"ListOperationError":0,"QueryError":0,"MutateError":0,"FieldMaskError":0,"AuthorizationError":0,"InternalError":0,"QuotaError":0,"AdError":0,"AdGroupError":0,"CampaignBudgetError":0,"CampaignError":0,"AuthenticationError":0,"AdGroupCriterionError":0,"AdCustomizerError":0,"AdGroupAdError":0,"AdSharingError":0,"AdxError":0,"AssetError":0,"BiddingError":0,"CampaignCriterionError":0,"CollectionSizeError":0,"CountryCodeError":0,"CriterionError":0,"CustomerError":0,"DateError":0,"DateRangeError":0,"DistinctError":0,"FeedAttributeReferenceError":0,"FunctionError":0,"FunctionParsingError":0,"IdError":0,"ImageError":0,"LanguageCodeError":0,"MediaBundleError":0,"MediaUploadError":0,"MediaFileError":0,"MultiplierError":0,"NewResourceCreationError":0,"NotEmptyError":0,"NullError":0,"OperatorError":0,"RangeError":0,"RecommendationError":0,"RegionCodeError":0,"SettingError":0,"StringFormatError":0,"StringLengthError":0,"OperationAccessDeniedError":0,"ResourceAccessDeniedError":0,"ResourceCountLimitExceededError":0,"YoutubeVideoRegistrationError":0,"AdGroupBidModifierError":0,"ContextError":0,"FieldError":0,"SharedSetError":0,"SharedCriterionError":0,"CampaignSharedSetError":0,"ConversionActionError":0,"ConversionAdjustmentUploadError":0,"ConversionUploadError":0,"HeaderError":0,"DatabaseError":0,"PolicyFindingError":2,"EnumError":0,"KeywordPlanError":0,"KeywordPlanCampaignError":0,"KeywordPlanNegativeKeywordError":0,"KeywordPlanAdGroupError":0,"KeywordPlanKeywordError":0,"KeywordPlanIdeaError":0,"AccountBudgetProposalError":0,"UserListError":0,"ChangeStatusError":0,"FeedError":0,"GeoTargetConstantSuggestionError":0,"CampaignDraftError":0,"FeedItemError":0,"LabelError":0,"BillingSetupError":0,"CustomerClientLinkError":0,"CustomerManagerLinkError":0,"FeedMappingError":0,"CustomerFeedError":0,"AdGroupFeedError":0,"CampaignFeedError":0,"CustomInterestError":0,"CampaignExperimentError":0,"ExtensionFeedItemError":0,"AdParameterError":0,"FeedItemValidationError":0,"ExtensionSettingError":0,"FeedItemTargetError":0,"PolicyViolationError":0,"MutateJobError":0,"PartialFailureError":0,"PolicyValidationParameterError":0,"SizeLimitError":0,"NotWhitelistedError":0,"ManagerLinkError":0,"CurrencyCodeError":0,"AccessInvitationError":0,"ReachPlanError":0,"InvoiceError":0,"ErrorCodeCase":68},"Message":"The resource has been disapproved since the policy summary includes policy topics of type PROHIBITED.","Trigger":{"BooleanValue":false,"Int64Value":0,"FloatValue":0.0,"DoubleValue":0.0,"StringValue":"","ValueCase":5},"Location":{"FieldPathElements":[{"FieldName":"operations","Index":0},{"FieldName":"create","Index":null},{"FieldName":"ad","Index":null},{"FieldName":"expanded_text_ad","Index":null}]},"Details":{"UnpublishedErrorCode":"","PolicyViolationDetails":null,"PolicyFindingDetails":{"PolicyTopicEntries":[{"Topic":"SYMBOLS","Type":2,"Evidences":[{"WebsiteList":null,"TextList":{"Texts":["!!"]},"LanguageCode":null,"DestinationTextList":null,"DestinationMismatch":null,"DestinationNotWorking":null,"ValueCase":4},{"WebsiteList":null,"TextList":{"Texts":["!!This"]},"LanguageCode":null,"DestinationTextList":null,"DestinationMismatch":null,"DestinationNotWorking":null,"ValueCase":4}],"Constraints":[]},{"Topic":"UNACCEPTABLE_SPACING","Type":2,"Evidences":[{"WebsiteList":null,"TextList":{"Texts":["!!This"]},"LanguageCode":null,"DestinationTextList":null,"DestinationMismatch":null,"DestinationNotWorking":null,"ValueCase":4}],"Constraints":[]}]}}}]}}" But in 4.0.0 nuget package: It will throw exception and response is null. the exception payload: Raw Exception: { "StatusCode": 3, "Details": "Request contains an invalid argument.", "RequestId": "9BGq_CNhZWXoQQStCjoKyw", "Failure": { "errors": [ { "errorCode": { "policyFindingError": "POLICY_FINDING" }, "message": "The resource has been disapproved since the policy summary includes policy topics of type PROHIBITED.", "trigger": { "stringValue": "" }, "location": { "fieldPathElements": [ { "fieldName": "operations", "index": "0" }, { "fieldName": "create" }, { "fieldName": "ad" }, { "fieldName": "expanded_text_ad" } ] }, "details": { "policyFindingDetails": { "policyTopicEntries": [ { "topic": "SYMBOLS", "type": "PROHIBITED", "evidences": [ { "textList": { "texts": [ "!!" ] } }, { "textList": { "texts": [ "!!This" ] } } ] }, { "topic": "UNACCEPTABLE_SPACING", "type": "PROHIBITED", "evidences": [ { "textList": { "texts": [ "!!This" ] } } ] } ] } } } ] } }

I was just wondering if it is expected behavior change? I didn't change any code or namespace. I only changed the dll version number. basically it shouldn't change the API behavior. do you have any document or thread mention this issue? Is it a by-design behavior change? or is it a bug in API?

config change: before:

<PackageReference Update="Google.Ads.GoogleAds" Version="2.9.0" />
    <PackageReference Update="Google.AdWords" Version="24.1.0" />
    <PackageReference Update="Google.Api.CommonProtos" Version="1.7.0" />
    <PackageReference Update="Google.Api.Gax" Version="2.10.0" />
    <PackageReference Update="Google.Api.Gax.Grpc" Version="2.10.0" />
    <PackageReference Update="Google.Apis" Version="1.41.1" />
    <PackageReference Update="Google.Apis.Auth" Version="1.41.1" />
    <PackageReference Update="Google.Apis.Core" Version="1.41.1" />
    <PackageReference Update="Google.Apis.Oauth2.v2" Version="1.41.1.1602" />
    <PackageReference Update="Google.Protobuf" Version="3.11.1" />
    <PackageReference Update="Grpc.Auth" Version="1.22.1" />
    <PackageReference Update="Grpc.Core" Version="1.22.1" />

After:

  <PackageReference Update="Google.Ads.GoogleAds" Version="4.0.0" />
    <PackageReference Update="Google.AdWords" Version="24.1.0" />
    <PackageReference Update="Google.Api.CommonProtos" Version="2.0.0" />
    <PackageReference Update="Google.Api.Gax" Version="3.0.0" />
    <PackageReference Update="Google.Api.Gax.Grpc" Version="3.0.0" />
    <PackageReference Update="Google.Apis" Version="1.48.0" />
    <PackageReference Update="Google.Apis.Auth" Version="1.48.0" />
    <PackageReference Update="Google.Apis.Core" Version="1.48.0" />
    <PackageReference Update="Google.Apis.Oauth2.v2" Version="1.48.0.1869" />
    <PackageReference Update="Google.Protobuf" Version="3.12.2" />
    <PackageReference Update="Grpc.Auth" Version="2.27.0" />
    <PackageReference Update="Grpc.Core" Version="2.29.0" />
AnashOommen commented 4 years ago

PartialFailure flag is no longer on the method overload, but on the request object now. See https://github.com/googleads/google-ads-dotnet/blob/master/examples/ErrorHandling/HandlePartialFailure.cs#L208

I wonder if there's some overload that still makes the old code work fine due to some weird C# type casting suppressing a compilation error.