Parse.com Cloud Code Google Maps API地理编码返回ZERO_RESULTS

时间:2015-06-14 11:01:40

标签: google-maps http google-maps-api-3 parse-platform geocoding

我写了以下parse.com云代码函数:

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);
        }
    });
});

现在所做的只是调用URL并记录结果。该URL是对Google的地理编码API的请求,该API在浏览器中调用时返回JSON对象,但在通过Cloud Code调用时返回ZERO_RESULTS。

非常感谢任何帮助!

0 个答案:

没有答案