USER_DOES_NOT_HAVE_ACCESS_TO_TEMPLATE

50 views
Skip to first unread message

Rc B

unread,
Jul 23, 2019, 4:23:48 PM7/23/19
to AdWords API and Google Ads API Forum
Hi,

I'm getting the following error when deploying media bundle ad:

{ "Message": "An error has occurred.", "ExceptionMessage": "AdWordsApiException: Exception of type 'Google.Api.Ads.AdWords.Lib.AdWordsApiException' was thrown. \r\n\r\nThe user does not have permissions to create a template ad for the given template.. (Error: AdError.USER_DOES_NOT_HAVE_ACCESS_TO_TEMPLATE, FieldPath: operations[0].operand.ad.templateId, Trigger: 419)\r\n\r\n", "ExceptionType": "Google.Api.Ads.AdWords.Lib.AdWordsApiException", "StackTrace": "\r\nServer stack trace: \r\n at Google.Api.Ads.Common.Lib.SoapFaultInspector`1.AfterReceiveReply(Message& reply, Object correlationState)\r\n at System.ServiceModel.Dispatcher.ImmutableClientRuntime.AfterReceiveReply(ProxyRpc& rpc)\r\n at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)\r\n at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)\r\n at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)\r\n at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)\r\n\r\nException rethrown at [0]: \r\n at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)\r\n at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)\r\n at Google.Api.Ads.AdWords.v201809.AdGroupAdServiceInterface.mutate(mutateRequest request)\r\n at Google.Api.Ads.AdWords.v201809.AdGroupAdService.mutate(AdGroupAdOperation[] operations)\r\n at GoogleAdwordsAPI.GoogleAdwordsProxy.CreateHTMLTemplateAd(HTMLTemplateAdDetails Details)\r\n at PropertySuiteAPI.Controllers.HomeController.UploadCustomHTML5Ad(String propertyId, Int32 width, Int32 height, String ResourceURI)\r\n at PropertySuiteAPI.Controllers.HomeController.ApproveCustomPropertyAd(String propertyId, ApprovePropertyAdRequest request)\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()" }

The docs state: "The user does not have permissions to create a template ad for the given template."
I haven't seen this error before and I use the very same code for a couple of years without any problems.

------------------------------------------------------------------------------------------------

code snippet:
var service = (AdGroupAdService)this.user.GetService(AdWordsService.v201809.AdGroupAdService);

var templateAd = new TemplateAd()
            {                
                name = Details.Name,
                templateId = 419,
                finalUrls = new string[] { Details.URL },
                displayUrl = Details.URL,
                dimensions = new Dimensions() {
                    width = Details.Width,
                    height = Details.Height
                }
            };

            var mediaBundle = new MediaBundle()
            {
                data = Details.ZipFileContent,
                entryPoint = "index.html", 
                type = MediaMediaType.MEDIA_BUNDLE
            };

templateAd.templateElements = new TemplateElement[] {
                new TemplateElement() {
                    uniqueName = "adData",
                    fields = new TemplateElementField[] {
                        new TemplateElementField() {
                            name = "Custom_layout",
                            fieldMedia = mediaBundle,
                            type = TemplateElementFieldType.MEDIA_BUNDLE
                        },
                        new TemplateElementField() {
                            name = "layout",
                            fieldText = "Custom",
                            type = TemplateElementFieldType.ENUM
                        },
                    },
                }
            };

            var adGroupAd = new AdGroupAd
            {
                ad = templateAd,
                adGroupId = Details.AdGroupId
            };

            var operations = new AdGroupAdOperation[] {
                new AdGroupAdOperation {
                    @operator = Operator.ADD,
                    operand = adGroupAd                    
                }
            };

            var adGroupAdReturnValue1 = service.mutate(operations);
            return adGroupAdReturnValue1.value.First().ad.id;     

------------------------------------------------------------------------------------------------

Any ideas?

thanks, Roby (-:  

Google Ads API Forum Advisor Prod

unread,
Jul 24, 2019, 2:01:28 AM7/24/19
to adwor...@googlegroups.com
Hi,

So I can have a closer look, could you provide the complete SOAP request and response logs that were generated when the error occurred? You may reply via Reply privately to author option. If you haven't enabled the SOAP logging yet, you may refer to the readMe section of the respective client library for instructions on how to do it. 

Additionally, since you mentioned that you have used the same code over the years to create the said ads (template 419), could you also confirm if you have indeed been whitelisted way back or have already met the requirements as mentioned in this blog post?

Regards,
Ejay
Google Ads API Team



ref:_00D1U1174p._5001UEGBaG:ref
Message has been deleted

Paul

unread,
Jul 24, 2019, 2:31:56 PM7/24/19
to AdWords API and Google Ads API Forum
We are dealing with the exact same issue. Our code has been working for about a year, and we just started seeing this error whenever we try to push an HTML5 ad. 

Google Ads API Forum Advisor Prod

unread,
Jul 25, 2019, 11:41:16 AM7/25/19
to adwor...@googlegroups.com
Hello Everyone,

If you're working with HTML5 Template Ads (419), and you start seeing USER_DOES_NOT_HAVE_ACCESS_TO_TEMPLATE, then please refer to this blog post on your next steps. We decided to give everyone some extra time through the shopping season last year to update their code and their accounts. We are now enforcing the error that as was mentioned in that blog post from 2018. Please follow the instructions in the blog post. If you're having difficulty migrating, feel free to reach out on a new thread.

Thanks,
Nadine Sundquist, Google Ads API Team

ref:_00D1U1174p._5001UEGBaG:ref

Rc B

unread,
Jul 26, 2019, 1:26:43 AM7/26/19
to AdWords API and Google Ads API Forum
thanks Nadine for checking this one. 
we'll confirm that we're reaching the 9K total spent and if we don't - we'll use the whitelist or the AMP solution.  
Reply all
Reply to author
Forward
0 new messages