2
votes

Over the last couple of months I've been building up a Neo4j database. I'm finding Neo4j & Cypher really easy to use and definitely appropriate for the kind of data that I'm working with.

I'm hoping there's someone out there who can offer a few pointers on how to get started with the REST API. I don't have any experience coding in Java and I'm finding the Neo4j documentation a little tricky to follow. From what I understand, it should be possible to send a REST request via a straightforward http URL (like this http://localhost:7474/db/data/relationship/types), which would retrieve some data in a JSON.

My end goal is some form of very high level dashboard to summarise the current status of my database, to show the data from a few high level Cypher queries like this one:

    match (n) return distinct(n.team), count(n)

Any advice you can offer would be greatly appreciated.

1

1 Answers

6
votes

You would better use the http transactional endpoint where you can send Cypher query statements like the one in your questions.

The default endpoint is http://yourserverurl:7474/db/data/transaction/commit

The Neo4j documentation to use it from Java :

http://neo4j.com/docs/stable/server-java-rest-client-example.html#_sending_cypher

Using the transactional endpoint has the benefit of being able to send multiple statements in one transaction which will result in the operation being committed or rolled back.

The ReST API is like any other http api, the only guidelines to follow are the body contents and cypher query parameters which are well explained in the Neo4j documentation : http://neo4j.com/docs/stable/rest-api.html