Lasse Vabe Rolstad
Lasse Vabe Rolstad

Reputation: 612

Neo4j REST API is returning 404

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.

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

{
    "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.

  1. Do i have to enable the rest api in anyway? Or what else might be wrong?
  2. Are there other ways to run queries?(Other than shell, webgui and rest)
  3. What are the prefred way to access the database? Is it the REST API?

Upvotes: 0

Views: 1904

Answers (1)

FylmTM
FylmTM

Reputation: 1997

TL;DR; Correct url - 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.

Get database 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.

Upvotes: 2

Related Questions