2013-05-04 121 views
1

我正在嘗試使用REST API來創建唯一節點。但是,我收到關於要求密鑰'uri'的錯誤(請參閱下文)。根據記錄的例子,這個調用創建並索引新創建的節點...所以不應該有'uri'參數。我的要求和回覆如下。我究竟做錯了什麼?Neo4j REST API - 創建唯一節點

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:

狀態:400,體:

{ 
    "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" 
    } 
} 

使用捲曲 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錯誤的請求 的Content-Length:489 內容編碼:UTF-8 內容類型:應用/ JSON 訪問控制允許來源:* 服務器:碼頭(6.1.25)

「message」:「意外字符('''(代碼39)):預期有效值(數字,字符串,數組,對象,'true','false'或'null')\ n at [Source:java.io.Str ingReader @ 1e70f68;行:1,列: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(未知來源)」] }

+0

您正在使用哪個版本的'neo4j'? – Nicholas 2013-05-04 17:06:13

+0

它可能來自您正在使用的庫(如果有)嚴重格式化您的請求。你嘗試過捲曲嗎? – RaduK 2013-05-06 07:06:23

+0

版本是1.8.2 – user2350063 2013-05-06 13:43:01

回答

相關問題