1

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 Answers 2

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.

1
  • Thanks Michael, I didn't try this one and now that I look at it, it seems the most logical answer. It works by the way ;-)
    – steven
    Jun 18, 2013 at 6:58
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.