Is there a particular recommendation for when to use which API? For example, one may be more efficient than the other? Per the documentation, the driver api is called 'official API'. Does that mean the Driver API should be preferred?
The recommended way would be to use the Driver API, a.k.a. the Bolt drivers.
Official drivers are supported in Java (or JVM in general), Python, Javascript/Node.js, .NET and Golang.
There are also a few community Bolt drivers that are up-to-date.
rich type support (including temporal and geospatial types)
routing support
bookmark support for causal clusters
If you are also part of polyglot Neo4j-based projects, you will be able to switch more easily from one project to the other, as drivers strive for exposing an homogeneous API across languages.
Thanks for this question and insight into the HTTP API vs. Driver. I have the same question but came up against these issues. I am creating an API that will communicate with Neo4j on the backend, and a frontend app that includes graph visualizations.
I want data returned with the resultDataContents set to graph because I need data in a format compatible with javascript visualization libraries. This is not a parameter that can be set in the driver (explained why not here) but it can be set over HTTP API.
For reasons other than visualizations, I need to access Neosemantics endpoints I've set in my Neo4j, i.e. /rdf. In the Neo4j Browser I can send :GET or :POST Cypher commands, which are really just shortcuts for HTTP requests to the /rdf endpoint (explained here). But in the drivers those cypher commands do not work.
So I concluded my project would be best built using requests to the HTTP API and Neosemantics endpoints, rather than the driver. I understand this is a specific case but I was curious if this seems like a bad design given your opposite recommendation! Thanks! This is my first Neo4j project so I have a lot to learn. @lingvisa@florent_biville
@marlo The access to Neosemantics is definitely a very good reason to stick to HTTP endpoints, so your choice of sticking to HTTP completely makes sense to me.
I use the HTTP API a lot due to its flexibility. I do a lot with Power Query and Power BI with graph data from Neo4j and the only way to get automatic refreshes in the Power BI online service for Neo4j-based data is to use the REST API. I will say that the REST API for Neo4j is a bit of a mess. It's probably one of the worst REST API's I've worked with, but once you understand it, you can control and manipulate it how you need.
Some of this is documented in a blog post I did where it shows how what you get from the Neo4j browser when running Cypher queries is not the same thing you get when you use the REST API. Also Neo4j's REST API does not return standardized results. Meaning you get entirely different JSON structures back, depending on the Cypher Query your write.
So you end up having to be better at writing deliberate Cypher queries to get exactly what you from the HTTP API.
Once you get used to it, I find the HTTP API decent to work with - just a bit frustrating.
The other API's do have similar issues also. For example the .Net API requires you to write specific types of queries based on the formatted results coming back from Neo4j Also.
I hope that helps a bit. Here's a link to an article I wrote interfacing Power BI using the HTTP REST API: