How can I send (programatically) a cypher query to neo4j browser (via get/post) in order to display the resulted graph?
e.g., something like: http://localhost:7474/browser/query='match n return n'
Asked
Active
Viewed 2,372 times
1 Answers
1
Example request
POST http://localhost:7474/db/data/cypher
Accept: application/json; charset=UTF-8
Content-Type: application/json
{
"query" : "MATCH (x {name: 'I'})-[r]->(n) RETURN type(r), n.name, n.age",
"params" : {
}
}
Example response
200: OK
Content-Type: application/json; charset=UTF-8
{
"columns" : [ "type(r)", "n.name", "n.age" ],
"data" : [ [ "know", "him", 25 ], [ "know", "you", null ] ]
}

FrobberOfBits
- 17,634
- 4
- 52
- 86
-
You can have the response JSON tough, not a graph representation as he's asking. – MarcoL Jun 05 '14 at 14:36
-
JSON represents the graph query result just fine. – buley Jun 05 '14 at 14:41
-
1For OP -- I looked into the browser, but it's hard to figure out how this works. The browser uses a javascript object called "editor". Submitting queries I'm pretty sure boils down to POSTing exactly as I've specified here, plus some javascript magic to format the JSON as a pretty graph. All the JS in the server is minified though, (and looking on github, looks like it's originally coffeescript anyway) so whoever wrote that probably needs to cite exactly what POST the JS is doing to do the pretty graph of the result. – FrobberOfBits Jun 05 '14 at 14:55
-
2The browser actually uses the transactional endpoint with the "graph" resultDataContent attribute – Michael Hunger Jun 05 '14 at 19:38
-
I do not believe this response addresses the heart of the question, which I admit was a bit poorly phrased. I think the questioner wanted to have a cypher query displayed in the browser interface without having to type or copy/paste the query into the interface, not run a query and get a JSON result. – augustearth Mar 29 '18 at 09:00
-
Based on this Github issue, I suspect it is not (yet) possible to open the Neo3j browser with a pre-composed query: https://github.com/neo4j/neo4j-browser/issues/133 – augustearth Mar 29 '18 at 09:09