Handling Detailed GeoJSON Polygons in Repliers API Requests

When working with our API, you may encounter situations where you need to pass a detailed GeoJSON polygon. If the polygon is too detailed and is passed in the request URL, a 414 (URL Too Long) error can occur. This guide will help you avoid this error by showing you how to include the polygon in the body of a POST request.

Why the Error Occurs


The 414 error happens when the URL exceeds the maximum length allowed by the server. This is common with detailed GeoJSON polygons, which can have many coordinates and therefore create a very long URL.

Solution: Use POST Requests


To avoid the 414 error, you can make a POST request and pass the polygon in the body of the request as JSON. You can also combine other request URL parameters with the map parameter in the body. Here’s how you can do this:

POST /listings?param1=value1&param2=value2 HTTP/1.1
Host: api.repliers.com
Content-Type: application/json
REPLIERS-API-KEY: {your-api-key}

{
  "map": [[[-79.14121,43.79041],[-79.132627,43.773059],[-79.188932,43.886988],[-79.200605,43.877832],[-79.236654,43.869665],[-79.265836,43.860011],[-79.281972,43.856051],[-79.322828,43.84689],[-79.368146,43.839214],[-79.386021,43.836139],[-79.41486,43.838616],[-79.423787,43.836635],[-79.475285,43.82227],[-79.480092,43.813352],[-79.480778,43.803441],[-79.485585,43.79799],[-79.493825,43.794025],[-79.556996,43.779649],[-79.601628,43.761303],[-79.61611,43.758572],[-79.629934,43.750141],[-79.625471,43.728064],[-79.616888,43.713177],[-79.606245,43.695555],[-79.601095,43.685873],[-79.593885,43.681156],[-79.590109,43.672465],[-79.582212,43.671224],[-79.574659,43.670975],[-79.535177,43.58325],[-79.424627,43.619052],[-79.385488,43.602645],[-79.315451,43.612092],[-79.14121,43.79041]]]
}


Need Help?


If you have any questions or need further assistance, please contact our support team.

Updated on: 17/07/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!