[[rest-api-add-node-to-index]]
=== Add node to index ===

Associates a node with the given key/value pair in the given index.

NOTE: Spaces in the URI have to be escaped.

CAUTION: This does *not* overwrite previous entries. If you index the
same key/value/item combination twice, two index entries are created. To
do update-type operations, you need to delete the old entry before adding
a new one.


.Final Graph
["dot", "Final-Graph-Add-node-to-index.svg", "neoviz"]
----
  N167 [
    label = "{Node\[167\]|}"
  ]
----

_Example request_

* *+POST+*  +http://localhost:7474/db/data/index/node/favorites+
* *+Accept:+* +application/json+
* *+Content-Type:+* +application/json+
[source,javascript]
----
{
  "value" : "some value",
  "uri" : "http://localhost:7474/db/data/node/167",
  "key" : "some-key"
}
----


_Example response_

* *+201:+* +Created+
* *+Content-Type:+* +application/json+
* *+Location:+* +http://localhost:7474/db/data/index/node/favorites/some-key/some%20value/167+
[source,javascript]
----
{
  "extensions" : {
  },
  "paged_traverse" : "http://localhost:7474/db/data/node/167/paged/traverse/{returnType}{?pageSize,leaseTime}",
  "outgoing_relationships" : "http://localhost:7474/db/data/node/167/relationships/out",
  "traverse" : "http://localhost:7474/db/data/node/167/traverse/{returnType}",
  "all_typed_relationships" : "http://localhost:7474/db/data/node/167/relationships/all/{-list|&|types}",
  "all_relationships" : "http://localhost:7474/db/data/node/167/relationships/all",
  "property" : "http://localhost:7474/db/data/node/167/properties/{key}",
  "self" : "http://localhost:7474/db/data/node/167",
  "outgoing_typed_relationships" : "http://localhost:7474/db/data/node/167/relationships/out/{-list|&|types}",
  "properties" : "http://localhost:7474/db/data/node/167/properties",
  "incoming_relationships" : "http://localhost:7474/db/data/node/167/relationships/in",
  "incoming_typed_relationships" : "http://localhost:7474/db/data/node/167/relationships/in/{-list|&|types}",
  "create_relationship" : "http://localhost:7474/db/data/node/167/relationships",
  "data" : {
  },
  "indexed" : "http://localhost:7474/db/data/index/node/favorites/some-key/some%20value/167"
}
----


