Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
cURL命令-Neo4j_Curl_Neo4j - Fatal编程技术网

cURL命令-Neo4j

cURL命令-Neo4j,curl,neo4j,Curl,Neo4j,我在将cURL用作Neo4j的HTTP clinet时遇到了一个问题。 当我编写这个命令时:curlhttp://localhost:7474/db/data/(或任何URL,如http://localhost:7474/db/data/node/)然后我得到JSON格式的结果: { "errors" : [ { "message" : "No authorization token supplied.", "code" : "Neo.ClientError.Security

我在将cURL用作Neo4j的HTTP clinet时遇到了一个问题。 当我编写这个命令时:
curlhttp://localhost:7474/db/data/
(或任何URL,如
http://localhost:7474/db/data/node/
)然后我得到JSON格式的结果:

{   "errors" : [ {
    "message" : "No authorization token supplied.",
    "code" : "Neo.ClientError.Security.AuthorizationFailed"   } ],   "authentication" : "http://localhost:7474/authentication" }

似乎您已经在服务器上启用了身份验证插件。

你应该试试这种形式的东西

curl --user username:password http://localhost:7474/db/data/

不同意@hydraruiz,我想您运行的是Neo4j 2.2.0-M0x版本。默认情况下,此服务器已启用身份验证。您首先需要通过提供用户名和密码来获取令牌

curl -H "Content-Type: application/json" -d '{"username":"neo4j", "password":"mypassword"}' http://localhost:7474/authentication
{
  "username" : "neo4j",
  "password_change" : "http://localhost:7474/user/neo4j/password",
  "password_change_required" : false,
  "authorization_token" : "53eaa48a972439012868a8d5463e0c3d",
  "authorization_token_change" : "http://localhost:7474/user/neo4j/authorization_token"
}
对RESTAPI的后续调用使用授权标头中的令牌。根据文档,http授权头的值是
Basic realm=“Neo4j”
加上以冒号为前缀的base64编码令牌。我们可以为此使用命令行工具:
echo-n:tokenstring“| base64
。为了简单起见,我发出了一个简单的cypher语句
match(n)returncount(n)

返回:

{"results":[{"columns":["count(n)"],"data":[{"row":[0]}]}],"errors":[]}
这意味着身份验证工作正常。

您也可以。在
conf/neo4j server.properties
文件中:

# Require (or disable the requirement of) auth to access Neo4j
dbms.security.auth_enabled=false
# Require (or disable the requirement of) auth to access Neo4j
dbms.security.auth_enabled=false