1
votes

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

2

2 Answers

1
votes

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.

0
votes

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.