1
我嘗試了一個簡單的密碼休息請求。但是,我收到了400個錯誤的請求作爲迴應。請求輸出似乎沒問題。怎麼了?Cypher請求通過Rest返回400錯誤請求,爲什麼?
public class HelloRest {
public static String SERVER_ROOT_URI = "http://localhost:7474/db/data/";
public static void main(String[] args) {
Client client = Client.create();
client.addFilter(new LoggingFilter(System.out));
WebResource cypher = client.resource(SERVER_ROOT_URI + "cypher");
String request = "{\"query\":\"MATCH (n) RETURN n\"}";
ClientResponse cypherResponse = cypher.post(ClientResponse.class, request);
System.out.println(cypherResponse);
}
}
我以爲我試過之前沒有成功,但現在它的工作。謝謝。 ClientResponse cypherResponse = cypher.accept(MediaType.APPLICATION_JSON).post(ClientResponse.class,request);' –