This chapter introduces the Neo4j HTTP API, and how to effectively use it.
The Neo4j transactional HTTP endpoint allows you to execute a series of Cypher statements within the scope of a transaction. The transaction may be kept open across multiple HTTP requests, until the client chooses to commit or roll back. Each HTTP request can include a list of statements, and for convenience you can include statements along with a request to begin or commit a transaction.
The server guards against orphaned transactions by using a timeout.
If there are no requests for a given transaction within the timeout period, the server will roll it back.
You can configure the timeout in the server configuration, by setting Operations Manual →
dbms.rest.transaction.idle_timeout to the number of seconds before timeout.
The default timeout is 60 seconds.
|In order to speed up queries in repeated scenarios, try not to use literals but replace them with parameters wherever possible. This will let the server cache query plans. See Cypher Manual → Parameters for more information.|
Responses from the HTTP API can be transmitted as JSON streams, resulting in better performance and lower memory overhead on the server side.
To use streaming, supply the header
X-Stream: true with each request.
Was this page helpful?