使用 Fusion Table API 拒绝授权



My Code :

public class restletexample {
    String URI = "https://www.googleapis.com/upload/fusiontables/v1/tables/tableid/import";
    HashMap<String, String> urlVariables = new HashMap<String, String>();
    String column = "'Moth', '30', '2012','efef','efefef'";
    public void testrestlet() {
        urlVariables.put("key=", "KEY");
        RestTemplate restTemplate = new RestTemplate();
        restTemplate.postForLocation(URI, column, urlVariables);
    }
    public static void main(String args[]) {
        restletexample rst = new restletexample();
        rst.testrestlet();
    }
}

例外:

Exception in thread "main" org.springframework.web.client.HttpClientErrorException: 401 Unauthorized

我已经在 API 控制台中生成了密钥,并且正在使用相同的密钥.我不知道为什么谷歌不授权我的请求。需要帮助...自从过去 4 小时以来打破了我的头.

您的 URI 似乎错误 - "tableid"应替换为表的实际 ID。

最新更新