REST API to Update Token gives 500 Internal Server if token value too large

Western_Dental
Level 1

Using this REST API http://developers.marketo.com/rest-api/assets/tokens/#create_and_update

REST Details:

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

POST /rest/asset/v1/folder/{{programID}}/tokens.json?access_token={{access_token}}&name=office12&type=script+block&folderType=Program&value= HTTP/1.1

Host: {{mktoServer}}

Content-Type: application/x-www-form-urlencoded

Accept: application/json

If I replace {{tokenValue}}  with 'xxx' it works fine, but if I keep adding 'x's it will eventually die.   I can successfully create a token of about 7K characters.  But somewhere above that, within nothing changing but the size of the token value,  Marketo  gives a 500 error: 

There is no documented size limits for Tokens.  I have been able to create and use tokens entered throught the UI that are 10 times bigger (70K characters) -- so I think the limit is imposed by the API not by a limit with the token value.

Error

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

<html>

    <head>

        <title>500 Internal Server Error</title>

    </head>

    <body bgcolor="white">

        <center>

            <h1>500 Internal Server Error</h1>

        </center>

        <hr>

        <center>nginx</center>

    </body>

</html>

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Also, this doesn't have a heckuva lot of inherent meaning:

{{access_token}}&amp;name=office12&amp;type=script+block&amp;folderType=Program&amp;value= HTTP/1.1

You can't be HTML-encoding ampersands in URLs on the wire. So this may be debugging output from your client app but it doesn't reflect (I certainly hope!) what it's sending to Marketo.

SanfordWhiteman
Level 10 - Community Moderator

I can set and get a token (VTL type, like in your example) of well over 7K using the API. Just tested with a 100K payload and it's fine.

Suspect your client library is mangling the payload.