Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 49 additions & 2 deletions modules/ROOT/pages/actions/transaction-configuration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,64 @@

For any transaction-initiating request (such as `/tx` or `tx/commit`), you can provide configuration options that apply for the duration of the whole transaction.


[[http-api-actions-access-mode]]
== Access Mode

To ensure efficient load balancing across a cluster, it is important to label transactions that only contain `READ` statements with a `READ` access mode.

This can be done by adding an `access-mode` header to the request, with a value of `READ`.

This feature was introduced in Neo4j version 4.4.4.

[WARNING]
====
If an `access-mode` configuration has *not* been provided, the default value is `WRITE`.

However, if you have clusters with link:https://neo4j.com/docs/operations-manual/current/clustering/internals/#clustering-routing[Server-side routing] disabled, the default value is `READ`.
However, if you have clusters with link:https://neo4j.com/docs/operations-manual/current/clustering/internals/#causal-clustering-routing[Server-side routing] disabled, the default value is `READ`.
====

[NOTE]
====
Please note that `access-mode` is not required for a Neo4j single instance.
====

_Example request_

* *+POST+* +http://localhost:7474/db/neo4j/tx/commit+
* *+Accept:+* +application/json;charset=UTF-8+
* *+Content-Type:+* +application/json+
* *+Access-Mode:+* +WRITE+

[source, JSON, role="nocopy"]
----
{
"statements": [
{
"statement": "CREATE (n) RETURN n"
}
]
}
----

_Example response_

* *+200:+* +OK+
* *+Content-Type:+* +application/json;charset=utf-8+

[source, JSON, role="nocopy"]
----
{
"results" : [ {
"columns" : [ "n" ],
"data" : [ {
"row" : [ { } ],
"meta" : [ {
"id" : 7,
"type" : "node",
"deleted" : false
} ]
} ]
} ],
"errors" : [ ]
}
----