Run queries inside a transaction

Once you have an open transaction by calling db/{name}/tx, you can run additional statements that form part of your transaction by calling the newly created transaction endpoint. The endpoint will be in the form db/{name}/tx/{txid}, where txid is provided in the response of the initial call to begin the transaction.

Example request

  • POST http://localhost:7474/db/neo4j/tx/18

  • Accept: application/json;charset=UTF-8

  • Content-Type: application/json

{
  "statements": [
    {
      "statement": "CREATE (n) RETURN n"
    }
  ]
}

Example response

  • 200: OK

  • Content-Type: application/json;charset=utf-8

{
  "results" : [ {
    "columns" : [ "n" ],
    "data" : [ {
      "row" : [ { } ],
      "meta" : [ {
        "id" : 12,
        "type" : "node",
        "deleted" : false
      } ]
    } ]
  } ],
  "errors" : [ ],
  "commit" : "http://localhost:7474/db/neo4j/tx/18/commit",
  "transaction" : {
    "expires" : "Mon, 20 Sep 2021 07:57:38 GMT"
  }
}