DMill
DMill

Reputation: 303

Neo4j REST API access via cURL

I've got Neo4j installed and running on a dedicated server (NEOSERVER). NEOSERVER is a Windows Server 2008 VM and Neo4J is running as a windows service. Ultimately, I would like to be able to write data to the Neo4j database from an application server (NEOAPP). As a simple proof-of-concept test, I am using cURL from NEOAPP to try to first have data returned from the REST API.

From the command line, I am running the following cURL command:

curl -H Accept:application/json http://NEOSERVER:7474/db/data/

I receive the following error:

curl(7): Failed to connect to NEOSERVER:7474; No error.

I can run the same cURL command (using localhost instead of NEOSERVER) on NEOSERVER and can succesfully return data.

I assumed this would be pretty straightforward, but am learning otherwise. I'm new to Neo4j obviously. So, the question is, how do I connect to the Neo4j REST API from an external machine (NEOAPP, for example)?

Upvotes: 1

Views: 2045

Answers (2)

Manpreet Kaur
Manpreet Kaur

Reputation: 21

Try This:

curl —u <username>:<password> \
     -H Accept:application/json \
     -H Content-Type:application/json \
     -v http://localhost:7474/db/data/

Upvotes: 2

Stefan Armbruster
Stefan Armbruster

Reputation: 39905

I'm assuming a DNS or network issue here. If a

ping NEOSERVER

does not succeed, either setup naming services correctly or use IP addresses instead.

If the ping runs fine, make sure you're not f***ed up by some firewall (either locally on your Windows box or somewhere in between).

Upvotes: 1

Related Questions