neo4j v2.0.0-M3 REST API batch insert

爷,独闯天下 提交于 2019-12-11 04:23:40

问题


I use batch insert for adding nodes using the RESY API I know how to do this before 2.0, but now I'm starting to use the labeled nodes, and I cant get it to work. I don't find how I can add the label to the node.

The documentation is not very clear (to me). http://docs.neo4j.org/chunked/2.0.0-M03/rest-api-node-labels.html

This is the json that send to the API:

Test1:

[{"method":"POST",
  "to":"/node",
  "body":{"name":"A"},"id":0},
 {"method":"POST",
  "to":"{0}/labels",
  "body":{"label":"user"}
}] 

Test2:

[{"method":"POST",
  "to":"/node",
  "body":{"name":"A"},"id":0},
 {"method":"POST",
  "to":"/node/{0}/labels",
  "body":{"label":"user"}
}] 

Test3:

[{"method":"POST",
  "to":"/node",
  "body":{"name":"A"},"id":0},
  "label":"user"
 }] 

thanks in advance Steven


回答1:


What is the error message you get?

Try this:

[{"method":"POST",
  "to":"/node",
  "body":{"name":"A"},"id":0},
 {"method":"POST",
  "to":"{0}/labels",
  "body":"user"}
] 

As you can see the body is only the label string.




回答2:


I really appreciate the answer - but this is just to add that for me the labels did not appear in the body > Metadata > Labels section. For some reason this is not updated and it was only when I ran a match against that label that I found they were in fact correct. So if you run the answer - don't see labels listed in the output - they may still be present.



来源:https://stackoverflow.com/questions/17132132/neo4j-v2-0-0-m3-rest-api-batch-insert

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!