3
  1. Is there a way I can get a less verbose rest api response in neo4j, perhaps something with just the node data? It seems like it's a bit of a waste of bandwidth to send all that extra data on every request.

  2. Why is all that metadata included in the response anyways? For instance, the base api url is repeated throughout, and once you have the node id, one can reliably predict the urls for all the properties like self, properties, relationships, etc... They don't seem like terribly volatile urls.


{
      "extensions" : {
      },
      "paged_traverse" : "http://localhost:7474/db/data/node/183/paged/traverse/{returnType}{?pageSize,leaseTime}",
      "outgoing_relationships" : "http://localhost:7474/db/data/node/183/relationships/out",
      "traverse" : "http://localhost:7474/db/data/node/183/traverse/{returnType}",
      "all_typed_relationships" : "http://localhost:7474/db/data/node/183/relationships/all/{-list|&|types}",
      "all_relationships" : "http://localhost:7474/db/data/node/183/relationships/all",
      "property" : "http://localhost:7474/db/data/node/183/properties/{key}",
      "self" : "http://localhost:7474/db/data/node/183",
      "outgoing_typed_relationships" : "http://localhost:7474/db/data/node/183/relationships/out/{-list|&|types}",
      "properties" : "http://localhost:7474/db/data/node/183/properties",
      "incoming_relationships" : "http://localhost:7474/db/data/node/183/relationships/in",
      "incoming_typed_relationships" : "http://localhost:7474/db/data/node/183/relationships/in/{-list|&|types}",
      "create_relationship" : "http://localhost:7474/db/data/node/183/relationships",
      "data" : {
      }
    }
MonkeyBonkey
  • 46,433
  • 78
  • 254
  • 460
  • Yeah, I think it is overly verbose. I try to avoid returning nodes and relationships themselves for this reason. – Eve Freeman Jan 14 '13 at 05:57

4 Answers4

4

The information sent is part of the REST discovery mechanism built into the HTTP API. Changing this would render a lot of existing client software broken as those values are used as a replacement for "educated guesswork".

The existing server provides no way to not produce this data but if its simply node properties that you are after, the http://localhost:7474/db/data/node/183/properties URI will just provide you that simple set of key-value pairs.

It is true that the URIs themselves do not appear to be particularly volatile. However, if these URIs were to change in a future server version, client software which had adhered to the discovery mechanism would be protected from that change.

Nigel Small
  • 4,475
  • 1
  • 17
  • 15
3

You could always write your own server plugin which serves data in the format you want.

Werner Kvalem Vesterås
  • 10,226
  • 5
  • 43
  • 50
3

If you use Cypher, you can trim down the amount of verbosity by just returning not full nodes/rels, but values on these that you need, see http://docs.neo4j.org/chunked/snapshot/rest-api-cypher.html

Peter Neubauer
  • 6,311
  • 1
  • 21
  • 24
  • I seem to remember someone telling me that I should use the transaction commit endpoint to be less verbose, is that true? – MonkeyBonkey Jul 15 '14 at 20:08
0

I ran across this unanswered question when I was looking for the same thing, so I know I might help someone out by plugging my solution to this problem. Trying to interpret the Node-Neo4j API

Community
  • 1
  • 1