私のコード:
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時間以来私の頭を壊しています。