NetworkError:403 Forbidden - http://www.googleapis.com/fusiontables/v1/query?谷歌融合表

时间:2013-05-23 19:23:26

标签: google-fusion-tables

我想知道我的代码中产生以下错误消息有什么问题: NetworkError:403禁止 - http://www.googleapis.com/fusiontables/v1/query

我相信我正在引用新的SQL V1 API,而我引用的表是允许导出数据的基表。

代码段

function getEcoliData(beachID) {
//local namespace
var rows = [];
var items = [];

var queryURL = "http://www.googleapis.com/fusiontables/v1/query?sql=";
var queryTail = '&jsonCallback=?';
var whereClause = "WHERE 'Beach_ID' = " + beachID;
var query = "SELECT 'Sample_Date', 'Average_E.coli_Density','Recreational_Water_Quality_Guideline' FROM 1-ZORhnuDELDxO1FsmzJ60K3JzWOYOKvsHibrQeo " + whereClause + " ORDER BY 'Sample_Date' DESC";
var queryText = encodeURI(query);

infoWindow = new google.maps.InfoWindow();
$.ajax({
    type: "GET",
    url: queryURL + queryText + queryTail,
    cache: false,
    dataType: 'jsonp',
    jsonCallback: 'jsonCallback',
    success: function (data) {
        rows = data.tables.rows;
        for (var i = 0; i < rows.length; i++) {
            items.push(rows[i]);
        }
        return items;
    },
    error: function () {
        alert("Data is not available for this location at the present time, please check back at a later time. Thank you.");
    }
});

}

欢迎任何建议。提前致谢。 迈克尔

1 个答案:

答案 0 :(得分:0)

使用https://代替http://。您还需要通过URL发送有效密钥(确保在使用密钥之前已在API-console内激活了Fusion-Tables-API服务)。