Unable to connect to local Neo4j Desktop from curl

Running Neo4j Desktop on mac. I've created a tiny graph with two nodes connected by one relationship. I want to send a POST request from curl to match all nodes and see what Neo4j sends back.

Following the API Query docs, I base64-encode the username (neo4j), colon, password (replaced by asterisks in what I will paste below) and add the headers the docs say to add.

My request:

% curl -X POST http://localhost:7474/db/neo4j/query/v2
-H "Content-Type: application/json"
-H "Accept: application/json"
-H "Authorization: Basic ****************"
-d '{"statement": "MATCH (n) RETURN n LIMIT 25"}'

And I get this error:

{"errors":[{"code":"Neo.ClientError.Security.Unauthorized","message":"Invalid credential."}]}

I've done this over and over, carefully following the docs, specifically:

I wonder whether this simple procedure works for others, or whether there's something I am missing. Thanks everyone!

You need to authenticate ...

This worked first time:

curl -u login:password -H "Content-Type: application/json" \
  -d '{"statements":[{"statement":"MATCH (n) RETURN n LIMIT 10"}]}' \
  http://localhost:7474/db/neo4j/tx/commit
1 Like

thanks, @joshcornejo ! I'll test that. It uses the old API, and I will also continue seeking a way to do this using the new Query API.

The problem from your original message is authentication anyway, nothing to do with versions of API.

That is the web server not letting you get through to the API call.