2

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 Answer 1

6

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Christophe. I guess I'm struggling a little because I don't have experience with Java, or indeed any other HTTP API. There seems to be some assumed knowledge in the Neo4j documentation which I'm missing! It it possible to type a URL (or a series of URLs) in my browser which will ask the Cypher query in my question, then simply return the results in JSON?
No it is not possible to type it directly in your common browser except if you use http tools like Postman. However the neo4j browser do it under the hood, just try it. Yes there is some required knowledge but it is the same with any other database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.