Neo4j REST API 返回 404
Neo4j REST API is returning 404
我目前正在评估 Neo4j DB (v. 2.2.6),我正在尝试连接到其余部分 API。要连接,我使用 C# 和 Neo4JClient(v. 1.1.0.10),而且我刚刚尝试 运行 与邮递员的 GET。
如果我 运行 GET againts http://localhost:7474/data/db/ 它 returns 没有任何 headers
{
"errors": [
{
"message": "No authorization header supplied.",
"code": "Neo.ClientError.Security.AuthorizationFailed"
}]
}
这确实有意义,因为我没有提供基本身份验证 header。我的问题是,当我将 Basic Auth header 添加到请求时,它 return 是一个 404,据我所知,任何请求都会 return 404。
- 我是否必须启用其余的 api?或者还有什么问题?
- 还有其他方法可以 运行 查询吗?(除了 shell、webgui 和 rest)
- 访问数据库的首选方式有哪些?是 REST API?
TL;DR;正确 url - http://localhost:7474/db/data/
您的设置中似乎有小问题 issue/typo。
让我们来看看所有这些东西。
我将在示例中使用 curl
。
获取数据库根目录:
curl -i --user neo4j:neo4j http://localhost:7474
结果:
HTTP/1.1 200 OK
Date: Wed, 21 Oct 2015 14:14:20 GMT
Content-Type: application/json; charset=UTF-8
Access-Control-Allow-Origin: *
Content-Length: 100
Server: Jetty(9.2.4.v20141103)
{
"management" : "http://localhost:7474/db/manage/",
"data" : "http://localhost:7474/db/data/"
}%
好的。让我们试着得到 data
url.
$ curl -i --user neo4j:neo4j http://localhost:7474/db/data/
HTTP/1.1 200 OK
Date: Wed, 21 Oct 2015 14:16:43 GMT
Content-Type: application/json; charset=UTF-8
Access-Control-Allow-Origin: *
Content-Length: 730
Server: Jetty(9.2.4.v20141103)
{
"extensions" : { },
"node" : "http://localhost:7474/db/data/node",
"node_index" : "http://localhost:7474/db/data/index/node",
"relationship_index" : "http://localhost:7474/db/data/index/relationship",
"extensions_info" : "http://localhost:7474/db/data/ext",
"relationship_types" : "http://localhost:7474/db/data/relationship/types",
"batch" : "http://localhost:7474/db/data/batch",
"cypher" : "http://localhost:7474/db/data/cypher",
"indexes" : "http://localhost:7474/db/data/schema/index",
"constraints" : "http://localhost:7474/db/data/schema/constraint",
"transaction" : "http://localhost:7474/db/data/transaction",
"node_labels" : "http://localhost:7474/db/data/labels",
"neo4j_version" : "2.2.5"
}%
一切正常。无需额外启用某些功能。
我目前正在评估 Neo4j DB (v. 2.2.6),我正在尝试连接到其余部分 API。要连接,我使用 C# 和 Neo4JClient(v. 1.1.0.10),而且我刚刚尝试 运行 与邮递员的 GET。
如果我 运行 GET againts http://localhost:7474/data/db/ 它 returns 没有任何 headers
{
"errors": [
{
"message": "No authorization header supplied.",
"code": "Neo.ClientError.Security.AuthorizationFailed"
}]
}
这确实有意义,因为我没有提供基本身份验证 header。我的问题是,当我将 Basic Auth header 添加到请求时,它 return 是一个 404,据我所知,任何请求都会 return 404。
- 我是否必须启用其余的 api?或者还有什么问题?
- 还有其他方法可以 运行 查询吗?(除了 shell、webgui 和 rest)
- 访问数据库的首选方式有哪些?是 REST API?
TL;DR;正确 url - http://localhost:7474/db/data/
您的设置中似乎有小问题 issue/typo。
让我们来看看所有这些东西。
我将在示例中使用 curl
。
获取数据库根目录:
curl -i --user neo4j:neo4j http://localhost:7474
结果:
HTTP/1.1 200 OK
Date: Wed, 21 Oct 2015 14:14:20 GMT
Content-Type: application/json; charset=UTF-8
Access-Control-Allow-Origin: *
Content-Length: 100
Server: Jetty(9.2.4.v20141103)
{
"management" : "http://localhost:7474/db/manage/",
"data" : "http://localhost:7474/db/data/"
}%
好的。让我们试着得到 data
url.
$ curl -i --user neo4j:neo4j http://localhost:7474/db/data/
HTTP/1.1 200 OK
Date: Wed, 21 Oct 2015 14:16:43 GMT
Content-Type: application/json; charset=UTF-8
Access-Control-Allow-Origin: *
Content-Length: 730
Server: Jetty(9.2.4.v20141103)
{
"extensions" : { },
"node" : "http://localhost:7474/db/data/node",
"node_index" : "http://localhost:7474/db/data/index/node",
"relationship_index" : "http://localhost:7474/db/data/index/relationship",
"extensions_info" : "http://localhost:7474/db/data/ext",
"relationship_types" : "http://localhost:7474/db/data/relationship/types",
"batch" : "http://localhost:7474/db/data/batch",
"cypher" : "http://localhost:7474/db/data/cypher",
"indexes" : "http://localhost:7474/db/data/schema/index",
"constraints" : "http://localhost:7474/db/data/schema/constraint",
"transaction" : "http://localhost:7474/db/data/transaction",
"node_labels" : "http://localhost:7474/db/data/labels",
"neo4j_version" : "2.2.5"
}%
一切正常。无需额外启用某些功能。