Database Reference
In-Depth Information
Listing 10.4. HTTP service root request and response
Because REST is accessible via the standard HTTP protocol, a whole raft of clients can
now be catered for, and not only those able to operate on the JVM. The following snippet
illustrates how the standard Unix curl client generated the HTTP request, the response to
which was detailed in
listing 10.4
.
This code snippet includes the setting of all the required
headers:
curl -X GET -H "Accept: application/json" -H "Content-Type: application/json"
http://localhost:7474/db/data/
Suppose you wanted to explore
chapter 9
's social networking graph from a particular start-
ing point, such as to get more information about Adam (an example user in the system
with the user ID of
adam001
). You'd first need to identify your starting REST URL. You
know that users in the system are indexed by their user IDs. Using
listing 10.4
as our start-
ing point, if you were using legacy indexes, you could use the base URL detailed against
the
node_index
key as the starting point for constructing the final URL needed to
look up Adam. Using schema-based indexing, you'd need to construct a URL using the
key. The fine-grained requests and associated response are shown in
node_labels
the following listing.