그러나자바 유리 염기 쿼리
URL url = null;
String inputLine;
try{
url = new URL("https://www.googleapis.com/freebase/v1/mqlread?query={\"id\":\"/en/madonna\", \"name\": null, \"type\":\"/base/popstra/celebrity\",\"/base/popstra/celebrity/friendship\": [{\"participant\": [] }] }");
} catch (MalformedURLException e) {
e.printStackTrace();
}
BufferedReader in;
try {
URLConnection con = url.openConnection();
con.setReadTimeout(1000); //1 second
in = new BufferedReader(new InputStreamReader(con.getInputStream()));
while ((inputLine = in.readLine()) != null) {
System.out.println(inputLine);
}
in.close();
} catch (IOException e) {
e.printStackTrace();
}
를 내가지고있어 다음과 같은 오류 :
java.io.IOException: Server returned HTTP response code: 400 for URL: https://www.googleapis.com/freebase/v1/mqlread?query={ "id":"/en/madonna", "name": null, "type": "/base/popstra/celebrity","/base/popstra/celebrity/friendship": [{ "participant": [] }] }
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at FreebaseCelebrities.main(FreebaseCelebrities.java:66)
이미 완료했습니다 이 (다른 요청과 함께) 전에 작동 했으므로 여기에 어떤 문제가 있습니까?
400은 나쁜 요청을 의미합니다. – PbxMan