如何将参数添加到Jersey cypher rest api?

时间:2018-02-04 01:34:09

标签: neo4j jersey

我有一个像这样的Neo4j RestAPI调用:

        {
          "query" : "MATCH (x)-[r:friend]->(y) where y.name={yname} RETURN  x, y",

           "params" : {
            "yname" : "Jack"
          }
        }

此查询有效。现在我想在Jersey Client中执行此查询:

       Client client = Client.create();
        client.addFilter(new LoggingFilter(System.out));
        client.addFilter(new HTTPBasicAuthFilter("neo4j", "test"));
        WebResource cypher = client.resource(SERVER_ROOT_URI + "cypher");
         String yname="Jack";
        String request = "{\"query\":\"MATCH (x)-[r:friend]->(y) where y.name={yname} RETURN  x, y\"}";

        ClientResponse cypherResponse = cypher.accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, request);
        cypherResponse.close();

如何表示yname =" Jack"在上面的代码中,查询会成功吗?

0 个答案:

没有答案