[[rest-api-create-a-unique-relationship-in-an-index]]
=== Create a unique relationship in an index ===

.Final Graph
["dot", "Final-Graph-Create-a-unique-relationship-in-an-index.svg", "neoviz"]
----
  N80 [
    label = "{Node\[80\]|}"
  ]
  N80 -> N81 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "knowledge\nname = \'Tobias\'\l"
  ]
  N81 [
    label = "{Node\[81\]|}"
  ]
----

_Example request_

* *+POST+*  +http://localhost:7474/db/data/index/relationship/knowledge/?unique+
* *+Accept:+* +application/json+
* *+Content-Type:+* +application/json+
[source,javascript]
----
{"key": "name", "value":"Tobias", "start": "http://localhost:7474/db/data/node/80", "end": "http://localhost:7474/db/data/node/81", "type": "knowledge"}
----


_Example response_

* *+201:+* +Created+
* *+Content-Type:+* +application/json+
* *+Location:+* +http://localhost:7474/db/data/index/relationship/knowledge/name/Tobias/90+
[source,javascript]
----
{
  "extensions" : {
  },
  "start" : "http://localhost:7474/db/data/node/80",
  "property" : "http://localhost:7474/db/data/relationship/90/properties/{key}",
  "self" : "http://localhost:7474/db/data/relationship/90",
  "properties" : "http://localhost:7474/db/data/relationship/90/properties",
  "type" : "knowledge",
  "end" : "http://localhost:7474/db/data/node/81",
  "data" : {
    "name" : "Tobias"
  },
  "indexed" : "http://localhost:7474/db/data/index/relationship/knowledge/name/Tobias/90"
}
----


