jasonc24
jasonc24

Reputation: 53

Neo4j MERGE using REST API

I am attempting to execute a MERGE function using Neo4j's REST API, and I am having a difficult time getting it to work. I have been leaning on the answer posted here, however even when I copy the REST content of that answer directly, I still get a (400) Bad Request error.

I am using a URL of http://<username>:<password>@<server IP>:7474/db/data/cypher. Other REST calls are working just find; I just can't get this one to go.

Here is the content of my REST request

{
  "params": {
    "props": [
      {
        "SerialNo": "AA",
        "Model": "2",
        "ProcessStatus": "-8",
        "FinalStepReached": "False"
      },
      {
        "SerialNo": "AB",
        "Model": "2",
        "ProcessStatus": "-8",
        "FinalStepReached": "False"
      },
      {
        "SerialNo": "AB",
        "Model": "3",
        "ProcessStatus": "-9",
        "FinalStepReached": "False"
      }
    ]
  },
  "query": "FOREACH (p in {props} | MERGE (n:Part {SerialNo:{p.SerialNo}}) ON CREATE  n.Model = {p.Model}) "
}

I am running Neo4j server v2.1.0-M01.

Any assistance you could offer would be appreciated!!

Upvotes: 1

Views: 338

Answers (1)

Bossie
Bossie

Reputation: 3612

Try removing the curly braces around p.SerialNo and p.Model in your query.

Also, it seems you forgot the SET keyword after ON CREATE.

Doesn't the 400 response contain any details regarding the actual error? Check the content.

Upvotes: 1

Related Questions