Loading

Maps API returning 4xx status codes

Date de publication: Feb 13, 2024
Description

While calling any Maps API (like Geocoding, GetHostedData, etc.) you may sometimes receive 4xx status codes. These codes indicate that requests need to be revised and any problems need to be corrected before trying again

Résolution

A 429 error code, as stated in the message body means the requests were throttled and you need to slow down the number of requests per minute you're trying to send. This can be rectified if you space them out. 

A 400 error code signifies a Bad Request or an Invalid request. There will be a message in the body to help you correct the requests. One common type of bad request involves sending over 50 addresses in a single call. If the geocoder's match score falls at 50 or below, your code is set to retry the call. However, making repeated calls with the same input data won't yield a different match value, which in turn results in a 429 error. So, to avoid this error, you need to make sure the correct address information is being provided before a call is made again. It's possible to automate this processing based on ‌responses. For example, if a single record has the content, { success: false, message: "Invalid address" }, you could have the apex code flag the record for manual review to ensure it is corrected.
Note: Bad requests also count against your limit of total requests allowed.

 

 

Numéro d’article de la base de connaissances

000989526

 
Chargement
Salesforce Help | Article