Database Reference
In-Depth Information
HTTP batch imports - REST API
Neo4j REST architecture is one of the most well-crafted and well-designed architectures.
Designed on principles of service discoverability, it exposes the service root, and from
there users can discover other URIs to perform various CRUD and search operations.
All endpoints are relative to http://<HOST>:<PORT>/db/data/ which is also
known as a service root for other REST end points. You can simply fire the service root,
using GET operations, and it will show its other REST endpoints.
The default representation for all types of request (POST/PUT) and response is JSON.
In order to interact with the JSON interface, users need to explicitly set the request header
as Accept:application/json and Content-Type:application/json .
One of the end points exposed by Neo4j REST architectures is /batch/ . This is used to
perform batch operations on the Neo4j database. It provides an interface for multiple API
calls through a single HTTP request, which significantly improves performance for a large
number of insert and update operations.
The API expects an array of job descriptions as input and each job description describes an
action to be performed via the normal server API.
This service is executed in a transaction, and in case any operation fails, all modifications
are rolled back.
Let's first understand the structure of a sample batch request, which defines multiple jobs
within a single request and then we will also execute the same request against our local
Neo4j database:
[ {
"method":"PUT",
"to": "/node/25/properties",
"body" :{
"Name": "Sylvester Stallone",
"Age" : "68"
},"id": 0
},
{
Search WWH ::




Custom Search