4

Is it possible to pass parameters along with a cypher query via Neo4j's web interface or shell? For example, is it possible to get Neo4j's web interface to execute this statement?

return {test};

Running this statement in the web interface results in an error:

Expected a parameter named test
Neo.ClientError.Statement.ParameterMissing

Ideally, I'd like to do something like:

{ test: "foo" } // specify the parameters I would normally pass via the REST API

// my normal query
return {test};

Is there a way to do this? I want to do this because I'm using the REST API on Neo4j and all my queries take parameters. If I want to test any of my queries on the web interface or shell, I need to manually edit the query to replace the {parameter} markup with either with declarations or raw input. I'd like to be able to simply copy/paste my query as-is into the web interface, supplying a set of parameters and have it work.

Does anyone know of a way to do this?

dbcb
  • 878
  • 7
  • 13

1 Answers1

5

It is possible in the shell, all "environment" variables are available as parameters.

so if you do:

export test="foo"
return {test} as t;
+-------+
| t     |
+-------+
| "foo" |
+-------+

You can see all environment variables with env

Unfortunately not possible in the browser yet, it would be cool to have, perhaps with a tampermonkey / a chrome plugin.

Michael Hunger
  • 41,339
  • 3
  • 57
  • 80
  • 2
    This functionality has been added to Neo4j-browser, see http://stackoverflow.com/questions/42397773/neo4j-what-is-the-syntax-to-set-cypher-query-parameters-in-the-browser-interfac (and especially Michael's comment) – miro marchi Apr 08 '17 at 11:22