Neo4j 3.2版本无法通过REST(HTTP)访问,求配置与授权解答
Hey there, let's work through this issue—this is a common gotcha with Neo4j 3.x's REST API, so I’ll break down what’s going on and how to fix it.
First: Use the Correct REST API Endpoint
The biggest mistake here is accessing the root URL (http://localhost:7474) directly for REST calls. In Neo4j 3.2, the official REST API entry point is http://localhost:7474/db/data/. The root path is reserved exclusively for the browser interface, which is why you’re seeing that "Activity Invocation Failed" error when hitting it with a REST client.
Check Your Neo4j Configuration
Before diving into auth, make sure your HTTP connector is properly enabled in the neo4j.conf file (usually located in your Neo4j installation’s conf directory):
- Look for
dbms.connector.http.enabled=true—this should be uncommented (remove the#at the start if it’s there). - Verify
dbms.connector.http.listen_address=:7474to ensure it’s listening on the correct port.
Authorization: Same as the Browser
Good news—Neo4j 3.2 doesn’t use a separate auth mechanism for REST vs. the browser. Both rely on Basic Authentication, so the username/password you use to log into the browser will work for REST calls too.
By default, the credentials are neo4j/neo4j, but you’re required to change this on your first browser login. If you’ve already updated your password, you’ll need to include those credentials in your REST requests.
Test with a Simple cURL Command
To confirm everything’s working, run this in your terminal (replace your_new_password with your actual password):
curl -u neo4j:your_new_password http://localhost:7474/db/data/
If successful, you’ll get a JSON response outlining the available REST API endpoints.
Quick Recap
- Use
http://localhost:7474/db/data/instead of the root URL for REST calls. - Ensure the HTTP connector is enabled in
neo4j.conf. - Include your browser’s login credentials in your REST requests (via Basic Auth).
内容的提问来源于stack exchange,提问作者Saurabh wagh

