有许多使用cUrl与Neo4j执行查询的例子,但我无法让它工作。 例如:https://neo4j.com/blog/export-csv-from-neo4j-curl-cypher-jq/
操作系统:Windows DB:Neo4j社区3.1.1 cUrl:7.53.1
"D:\Programme\Tools\curl\curl.exe" -H "Content-Type: application/json" -d '{"statements":[{"statement":
"match (n) return count(n)"}]}' http://localhost:7474/db/data/transaction/commit
结果:
{"results":[],"errors":[{"code":"Neo.ClientError.Request.InvalidFormat","message":"Unable to deserialize request: Unexpe
cted character (''' (code 39)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [
Source: HttpInputOverHTTP@18463df6; line: 1, column: 2]"}]}
答案 0 :(得分:1)
可能是因为您没有在URL中传递数据库的用户名和密码。试试这个,它对我有用:
curl -X POST -H 'Content-type: application/json' http://DB_USERNAME:DB_PASSWORD@localhost:7474/db/data/transaction/commit -d '{"statements": [{"statement": "MATCH (n) RETURN n;"}]}'