Skip to content Skip to sidebar Skip to footer

Batch Requests For Google Places (javascript V3)

Is there a way to batch requests for the Places Library in JavaScript? I've seen this page, so I've gathered it's possible, at least, I'm just not sure how it'd work with Places AP

Solution 1:

Well, here was my solution in Javascript:

var intId = setInterval(function() {
    try {
        service.getDetails(place, getMorePlaceDetails);
        clearInterval(intId);
    } catch(e) {
        console.info("Could not get detailed information about "+place.name+"; retrying in 3...");
    }
}, 3000);

Every place that threw an exception when it tried to get more details was retried in 3 seconds.

Solution 2:

Batching is supported for some of Google's, and is really easily achieved with the API client library (at least in PHP). Unfortunately, Places is not one of the supported APIs.

But that doesn't really matter in your case because even if you batch them, they still all count toward your query limit.

Post a Comment for "Batch Requests For Google Places (javascript V3)"