Neo4j REST API - create unique node -


i trying use rest api create unique node. however, getting error requiring key 'uri' (see below). based on documented examples, call creates , indexes newly created node ... there should not 'uri' paramater. request , response below. doing wrong?

request:

http://www.somemachine.com:7474/db/data/index/node/idxhost?unique=get_or_create

{     "key": "name",     "value": "host",     "properties": {         "type": "company",         "name": "host",         "sequence": 1     } } 

response:

state:400, body:

{   "message" : "missing required key: \"uri\"",   "exception" : "badinputexception",   "fullname" : "org.neo4j.server.rest.repr.badinputexception",   "stacktrace" : [ "org.neo4j.server.rest.repr.formats.jsonformat.readmap(jsonformat.java:92)", "org.neo4j.server.rest.web.restfulgraphdatabase.addtonodeindex(restfulgraphdatabase.java:802)", "java.lang.reflect.method.invoke(method.java:601)" ],   "cause" : {     "message" : "missing required key: \"uri\"",     "exception" : "badinputexception",     "stacktrace" : [ "org.neo4j.server.rest.repr.defaultformat.validatekeys(defaultformat.java:153)", "org.neo4j.server.rest.repr.formats.jsonformat.readmap(jsonformat.java:88)", "org.neo4j.server.rest.web.restfulgraphdatabase.addtonodeindex(restfulgraphdatabase.java:802)", "java.lang.reflect.method.invoke(method.java:601)" ],     "fullname" : "org.neo4j.server.rest.repr.badinputexception"   } } 

using curl c:\apps\curl\curl-7.28.1-win64-nossl>curl -i -h "accept: application/json" -h "content-type: application/json" -x post -d '{"key":"name","value":"host","propert ies":{"type":"company","name":"host","sequence":1}}' http://www.somemachine.com:7474/db/data/index/node/idxhost?unique=get_or_create http/1.1 400 bad request content-length: 489 content-encoding: utf-8 content-type: application/json access-control-allow-origin: * server: jetty(6.1.25)

{ "message" : "unexpected character (''' (code 39)): expected valid value (number, string, array, object, 'true', 'false' or 'null')\n @ [source: java.io.str ingreader@1e70f68; line: 1, column: 2]", "exception" : "badinputexception", "stacktrace" : [ "org.neo4j.server.rest.repr.formats.jsonformat.readmap(jsonformat.java:92)", "org.neo4j.server.rest.web.restfulgraphdatabase.addtonodeindex(r estfulgraphdatabase.java:776)", "java.lang.reflect.method.invoke(unknown source)" ] }

according doc, in 1.8 url ends '?unique' whereas in 1.9 '?uniqueness=get_or_create'

i think may cause error.

see 1.8: http://docs.neo4j.org/chunked/stable/rest-api-unique-indexes.html#rest-api-add-a-node-to-an-index-unless-a-node-already-exists-for-the-given-mapping

and 1.9: http://docs.neo4j.org/chunked/milestone/rest-api-unique-indexes.html


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -