我尝试了一个简单的密码休息请求。但我收到 400 Bad Request 作为响应。请求输出看起来没问题。怎么了?
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);
}
}
最佳答案
确保对 Accept
和 Content-Type
HTTP header 使用 application/json
。如果这没有帮助,请转储完整的请求和完整的回复,并将它们附加到您的问题中。
关于java - 通过 Rest 的 Cypher 请求返回 400 Bad Request,为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21886106/