REST Get Multiple Leads by List Id - 414 Request URI Too Long | Community
Skip to main content
March 10, 2015
Solved

REST Get Multiple Leads by List Id - 414 Request URI Too Long

  • March 10, 2015
  • 5 replies
  • 3108 views

I am extracting lead data using the 'Get Multiple Leads by List Id' REST API with GET method. However there are more that 650 fields that are required to be fetched. If I pass a comma separated list of all the fields as the URL param and make a GET request, the api returns a 414 Request-URI Too Long error.

Is there a way to fetch all the fields (more that 650) from marketo using the REST API? The api does not support POST method.

Error response in POSTMAN:

<html>
<head>
    <title>414 Request-URI Too Large</title>
</head>
<body bgcolor="white">
    <center>
        <h1>414 Request-URI Too Large</h1>
    </center>
    <hr>
        <center>nginx</center>
    </body>
</html>
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
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.

5 replies

March 13, 2015
Hi Travis Kaufman and Erik Rehn,

can you please look into this and suggest us how to handle this?

Thanks

Anil Upadhyay
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.
Accepted solution
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"
  ]
}
 
March 19, 2015
Looks like using the POST method and sending "fields=company,site" as post parameters works fine.