Parse.com Cloud Code Google Maps API Geocoding returns ZERO_RESULTS

257 views Asked by At

I wrote the following parse.com cloud code function:

Parse.Cloud.define("googleApiLatLong", function(request, response) {
    Parse.Cloud.httpRequest({
        url: "http://maps.googleapis.com/maps/api/geocode/json?address=Mannheim,Opernplatz",
        success: function(httpResponse) {
            console.log(httpResponse.text);
            response.success(httpResponse.text); // This will respond with the contents of the http response
        },
        error: function(httpResponse) {
            console.error('Request failed with response code ' + httpResponse.status);
            response.error('Request failed with response code ' + httpResponse.status);
        }
    });
});

All it does for now is calling a URL and logging the result. The URL is a request to Google's Geocoding API that returns a JSON Object when called in browser, but returns ZERO_RESULTS when called via Cloud Code.

Any help is highly appreciated!

0

There are 0 answers