SOLVED

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

Go to solution
Anonymous
Not applicable

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

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>
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

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

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.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

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

Hi Travis Kaufman and Erik Rehn,

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

Thanks

Anil Upadhyay
Anonymous
Not applicable

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

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.
Anonymous
Not applicable

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

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.
Anonymous
Not applicable

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

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"
  ]
}
 
Anonymous
Not applicable

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

Looks like using the POST method and sending "fields=company,site" as post parameters works fine.