restmarketo

414 Request-URI too long - Marketo REST API Get Muliple Leads by List ID


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>

Solution

  • I was able to resolve this using POST method and passing the fields parameter as a post parameter.

    curl -X POST -H "Authorization: Bearer <access_token>" -H "Cache-Control: no-cache" 
    -H "Content-Type: multipart/form-data;" -F "fields=company" 
    "https://<endpoint>/rest/v1/list/1001/leads.json?_method=GET"