Marketo REST API gives invalid HTTP response when request URI is too long | Community
Skip to main content
March 12, 2015
Question

Marketo REST API gives invalid HTTP response when request URI is too long

  • March 12, 2015
  • 3 replies
  • 1272 views
The Marketo REST API does not return a valid HTTP response in JSON format when the request URI exceed a particular limit. Due to this we are unable to handle this scenario where for Get Multiple Leads by List ID api, the user has provided a large list of fields leading to a long request uri.

Is this a bug in the Marketo REST API?
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

March 13, 2015
On further investigation I found then whenever there is a 414 - Request URI is too long error, Marketo does not return any headers in the response which makes it difficult to handle such responses by the client.
 
March 17, 2015
The workaround here is to use the POST method instead of GET. This should allow you to get around request limitations with GET because of the long URL. 

If using the POST method, you will need to pass the parameter "_method=GET" with your request.
March 17, 2015
I tried using the POST method with "_method=GET". But the API does not recognize the fields parameter that I pass in the post body and only returns the default fields. Could you please give me an example code that I can refer for setting the fields parameter in the POST body.

Here is what I tried:
fields=company,site

{
  "fields": "company,site"
}
 
{
  "fields": [
    "company",
    "site"
  ]
}