我正在尝试使用 REST API 创建一个唯一节点。但是,我收到有关需要密钥“uri”的错误(见下文)。根据记录的示例,此调用创建并索引新创建的节点......所以不应该有一个“uri”参数。我的要求和回应如下。我究竟做错了什么?
要求:
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
}
}
回复:
状态: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"
}
}
使用 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","properies":{"type":"company","name":"HOST","sequence":1}}' http://www .somemachine.com:7474/db/data/index/node/idxHost?unique=get_or_create HTTP/1.1 400 错误请求内容长度:489 内容编码:UTF-8 内容类型:application/json 访问控制允许-来源:* 服务器:码头(6.1.25)
{ "message" : "Unexpected character (''' (code 39)): 需要一个有效值(数字、字符串、数组、对象、'true'、'false' 或 'null')\n at [Source: java .io.StringReader@1e70f68;行:1,列:2]","异常":"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(未知来源)"] }