Marketo Token Create API call throw 709 Business Rule Violation Error | Community
Skip to main content
New Participant
July 8, 2020
Question

Marketo Token Create API call throw 709 Business Rule Violation Error

  • July 8, 2020
  • 1 reply
  • 4259 views

I am running into an issue where my API call to create token is failing. The error response is 709 (Business Rule Violation) with message saying Not a valid Script Token value.

 

I am using the following documentation for reference - https://developers.marketo.com/rest-api/endpoint-reference/asset-endpoint-reference/#!/Tokens/addTokenTOFolderUsingPOST 

 

Token data type = script block (NOTE: I did not find official documentation of this data type https://developers.marketo.com/rest-api/assets/tokens/)

 

Please check the HTTP request & response screenshots below.

HTTP Response

HTTP Request

 
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

SanfordWhiteman
New Participant
July 8, 2020

The script token type is deprecated via API; even when it works, you have to do some advanced Velocity to actually use the code.

 

The specific reason this call isn't working is because you aren't encoding the payload correctly, but I'd encourage you to avoid writing this token type via API. What is the overall logic that you're trying to implement from a business perspective?

tdesaiAuthor
New Participant
July 9, 2020

I am trying to render dynamic content in the email. I am trying to do this by setting an array of json objects via the token API call  -

$defaultDocs velocity script variable eg.

 

 

#set($defaultDocs = [{id:1, url: 'test.url.com', title:'test link1'}, ...])

 

 

I have a separate token at the email program level (this one I set via MarketoUI and NOT via API call reason being this is "static" vs the above one) where-in I do a for loop over this array collection like so

 

 

 

#set($urls=[]) #foreach($doc in $defaultDocs) $urls.add($doc.url) #end #foreach($doc in $defaultDocs) #set($i = $foreach.count - 1) <a href="https://${urls[$i]}">$doc.title</a> #end

 

 

 

 

SanfordWhiteman
New Participant
July 9, 2020

velocity script variable eg.#set($defaultDocs = [{id:1, url: 'test.url.com', title:'test link1'}, ...])

Hmm, that's not valid Velocity code, though. (Nor is it valid JSON, though Velocity only supports a subset of JSON.)

 

Anyway....

 

Is this used in a Trigger context, Batch, or both? (Yes, this matters.)