Database Reference
In-Depth Information
Listing 10.6. HTTP request and response for all of Adam's relationships
From these responses, you could continue exploring or discovering the graph as required
with additional calls. Although this discoverable approach holds fast to the core principles
behind REST, it makes the basic fine-grained REST API quite a chatty protocol, often re-
quiring multiple over-the-wire requests to satisfy basic graph queries. This does not bode
wellforperformance.Inthefollowingsections,you'llseewhatkindsofapproachescanbe
used to reduce the chattiness, but you should now have a good basic understanding of how
the core REST API is designed and functions.
10.3.3. Using the Cypher Neo4j server REST API endpoint
You can, more often than not, use the Cypher REST endpoint to achieve the same result as
you'd get from following the various fine-grained REST API calls from a client, but with
fewer network hops and more control. As you'll see moving forward, the use of Cypher is
very much encouraged as a way to reduce some of the chattiness of your calls.
The following listing shows how you can execute a Cypher query over the REST API to
get both the basic node info for Adam, plus a listing of all Adam's relationships, in one
 
Search WWH ::




Custom Search