How to test URI query string length? | Community
Skip to main content
Mike_Dinnis
New Participant
July 31, 2019
Solved

How to test URI query string length?

  • July 31, 2019
  • 1 reply
  • 4395 views

In various places within the developer documentation (error-codes, REST API exception and error handling) we are advised:

414 will be returned when the URI of a GET request exceeds 8KB.  To avoid it, check against the length of your query string to see if it exceeds this limit.

How do I check the length of a URI GET request query string in C# to avoid a 414 error?

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

Umm String.Length?

Of course you can wrap this in a method of a class that extends your HTTP library (whatever that is) as .ensureMaxLength() or whatever.

Not really a Marketo question.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
July 31, 2019

Umm String.Length?

Of course you can wrap this in a method of a class that extends your HTTP library (whatever that is) as .ensureMaxLength() or whatever.

Not really a Marketo question.

Mike_Dinnis
New Participant
July 31, 2019

String.Length will return the number of characters in a string and not the size e.g. 8KB. Am I missing something here?

I agree that this isn't really a Marketo question, but since it's advocated as best practice in a few places I thought someone would know the best way to do this.

SanfordWhiteman
New Participant
July 31, 2019

 A URL-encoded String is ASCII. Every internal char in the string becomes 1 byte wide on the wire, e.g. %20 is 3 bytes.