Neo4j REST API返回404

时间:2022-09-15 17:57:48

I am currently evaluating the Neo4j DB (v. 2.2.6) and i am trying to connect to the rest API. To connect i use C# and Neo4JClient(v. 1.1.0.10) and also i have just tried to run a GET with postman.

我目前正在评估Neo4j DB(v.2.2.6),我正在尝试连接到其余的API。连接我使用C#和Neo4JClient(v.1.1.0.10),我刚刚尝试与邮递员一起运行GET。

if i run GET againts http://localhost:7474/data/db/ it returns without any headers

如果我运行GET againts http:// localhost:7474 / data / db /它返回没有任何标题

{
    "errors": [
 {
    "message": "No authorization header supplied.",
    "code": "Neo.ClientError.Security.AuthorizationFailed"
  }]
}

This does make sence because i dident provide the basic auth header. My issue is when i add the Basic Auth header to the request it returns a 404, and as far as i can tell it will return 404 for any request.

这确实是因为我需要提供基本的auth标头。我的问题是,当我向请求添加Basic Auth标头时,它返回404,并且据我所知,它将为任何请求返回404。

  1. Do i have to enable the rest api in anyway? Or what else might be wrong?
  2. 无论如何我是否必须启用其余的api?或者还有什么可能是错的?
  3. Are there other ways to run queries?(Other than shell, webgui and rest)
  4. 还有其他方法来运行查询吗?(除了shell,webgui和rest)
  5. What are the prefred way to access the database? Is it the REST API?
  6. 访问数据库的prefred方法是什么?它是REST API吗?

1 个解决方案

#1


0  

TL;DR; Correct url - http://localhost:7474/db/data/

TL; DR;更正网址 - http:// localhost:7474 / db / data /

Looks like there is minor issue/typo in your setup.
Let's walk through all this stuff.

看起来您的设置中存在小问题/拼写错误。让我们来看看这些东西吧。

I will use curl in my examples.

我会在我的例子中使用curl。

Get database root:

获取数据库root:

curl -i --user neo4j:neo4j http://localhost:7474

Result:

结果:

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/"
}% 

Okay. Let's try to get 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"
}% 

Everything works as expected. There is no need to additionaly enable something.

一切都按预期工作。没有必要另外启用一些东西。

#1


0  

TL;DR; Correct url - http://localhost:7474/db/data/

TL; DR;更正网址 - http:// localhost:7474 / db / data /

Looks like there is minor issue/typo in your setup.
Let's walk through all this stuff.

看起来您的设置中存在小问题/拼写错误。让我们来看看这些东西吧。

I will use curl in my examples.

我会在我的例子中使用curl。

Get database root:

获取数据库root:

curl -i --user neo4j:neo4j http://localhost:7474

Result:

结果:

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/"
}% 

Okay. Let's try to get 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"
}% 

Everything works as expected. There is no need to additionaly enable something.

一切都按预期工作。没有必要另外启用一些东西。