[[rest-api-send-a-query]]
=== Send a Query ===

A simple query returning all nodes connected to node 1, returning the
node and the name property, if it exists, otherwise `null`:


[source,cypher]
----
START x  = node(23)
MATCH x -[r]-> n
RETURN type(r), n.name?, n.age?
----


.Final Graph
["dot", "Final-Graph-Send-a-Query.svg", "neoviz"]
----
  N21 [
    label = "{Node\[21\]|name = \'you\'\l}"
  ]
  N22 [
    label = "{Node\[22\]|age = 25\lname = \'him\'\l}"
  ]
  N23 [
    label = "{Node\[23\]|name = \'I\'\l}"
  ]
  N23 -> N22 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "know\n"
  ]
  N23 -> N21 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "know\n"
  ]
----

_Example request_

* *+POST+*  +http://localhost:7474/db/data/cypher+
* *+Accept:+* +application/json+
* *+Content-Type:+* +application/json+
[source,javascript]
----
{"query": "start x  = node(23) match x -[r]-> n return type(r), n.name?, n.age?","params": {}},
----


_Example response_

* *+200:+* +OK+
* *+Content-Type:+* +application/json+
[source,javascript]
----
{
  "columns" : [ "type(r)", "n.name?", "n.age?" ],
  "data" : [ [ "know", "him", 25 ], [ "know", "you", null ] ]
}
----


