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 (-:  

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/fcf70335-40d2-4206-ae0b-6ec799e8cc8a%40googlegroups.com.

Reply via email to