Skip to content

Commit b0835c3

Browse files
Neo4j 3.5
1 parent ec714ac commit b0835c3

20 files changed

+108
-680
lines changed

antora.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: http-api
22
title: HTTP API
3-
version: '4.4-preview'
4-
prerelease: true
3+
version: '3.5'
4+
prerelease: false
55
start_page: ROOT:index.adoc
66
nav:
77
- modules/ROOT/content-nav.adoc
88
asciidoc:
99
attributes:
10-
neo4j-version: '4.4'
11-
neo4j-version-exact: '4.4.0'
12-
neo4j-buildnumber: '4.4'
10+
neo4j-version: '3.5'
11+
neo4j-version-exact: '3.5.29'
12+
neo4j-buildnumber: '3.5'

modules/ROOT/content-nav.adoc

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
* xref:index.adoc[]
22
* xref:introduction.adoc[]
3-
* xref:discovery.adoc[]
43
* xref:actions/index.adoc[]
5-
** xref:actions/transaction-flow.adoc[]
6-
** xref:actions/query-format.adoc[]
7-
** xref:actions/result-format.adoc[]
4+
** xref:actions/begin-and-commit-a-transaction-in-one-request.adoc[]
5+
** xref:actions/execute-multiple-statements.adoc[]
86
** xref:actions/begin-a-transaction.adoc[]
97
** xref:actions/execute-statements-in-an-open-transaction.adoc[]
108
** xref:actions/reset-transaction-timeout-of-an-open-transaction.adoc[]
119
** xref:actions/commit-an-open-transaction.adoc[]
1210
** xref:actions/rollback-an-open-transaction.adoc[]
13-
** xref:actions/begin-and-commit-a-transaction-in-one-request.adoc[]
14-
** xref:actions/execute-multiple-statements.adoc[]
1511
** xref:actions/include-query-statistics.adoc[]
1612
** xref:actions/return-results-in-graph-format.adoc[]
17-
** xref:actions/expired-transactions.adoc[]
1813
** xref:actions/handling-errors.adoc[]
1914
** xref:actions/handling-errors-in-an-open-transaction.adoc[]
2015
* xref:security/index.adoc[]

modules/ROOT/pages/actions/begin-a-transaction.adoc

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,61 +3,57 @@
33
[[http-api-begin-a-transaction]]
44
= Begin a transaction
55

6-
A new transaction can be started by posting zero or more Cypher queries to the transaction endpoint.
7-
The server will respond with the results of your queries, as well as the location of your new transaction.
8-
9-
Transactions expire automatically after a period of inactivity (i.e. queries and a commit).
10-
By default this is `60` seconds.
11-
12-
To keep a transaction alive without submitting new queries, an empty statement list can be posted to the transaction URI.
6+
You begin a new transaction by posting zero or more Cypher statements to the transaction endpoint. The server will respond with the result of your statements, as well as the location of your open transaction.
137

148
_Example request_
159

16-
* *+POST+* +http://localhost:7474/db/neo4j/tx+
10+
* *+POST+* +http://localhost:7474/db/data/transaction+
1711
* *+Accept:+* +application/json;charset=UTF-8+
1812
* *+Content-Type:+* +application/json+
1913

2014
[source, JSON, role="nocopy"]
2115
----
2216
{
23-
"statements" : [ {
24-
"statement" : "CREATE (n $props) RETURN n",
25-
"parameters" : {
26-
"props" : {
27-
"name" : "My Node"
17+
"statements": [
18+
{
19+
"statement": "CREATE (n $props) RETURN n",
20+
"parameters": {
21+
"props": {
22+
"name": "My Node"
23+
}
2824
}
2925
}
30-
} ]
26+
]
3127
}
3228
----
3329

3430
_Example response_
3531

3632
* *+201:+* +Created+
37-
* *+Content-Type:+* +application/json;charset=utf-8+
38-
* *+Location:+* +http://localhost:7474/db/neo4j/tx/16+
33+
* *+Content-Type:+* +application/json+
34+
* *+Location:+* +http://localhost:7474/db/data/transaction/10+
3935

4036
[source, JSON, role="nocopy"]
4137
----
4238
{
39+
"commit" : "http://localhost:7474/db/data/transaction/10/commit",
4340
"results" : [ {
4441
"columns" : [ "n" ],
4542
"data" : [ {
4643
"row" : [ {
4744
"name" : "My Node"
4845
} ],
4946
"meta" : [ {
50-
"id" : 11,
47+
"id" : 10,
5148
"type" : "node",
5249
"deleted" : false
5350
} ]
5451
} ]
5552
} ],
56-
"errors" : [ ],
57-
"commit" : "http://localhost:7474/db/neo4j/tx/16/commit",
5853
"transaction" : {
59-
"expires" : "Mon, 20 Sep 2021 07:57:37 GMT"
60-
}
54+
"expires" : "Mon, 27 Sep 2021 08:28:00 +0000"
55+
},
56+
"errors" : [ ]
6157
}
6258
----
6359

modules/ROOT/pages/actions/begin-and-commit-a-transaction-in-one-request.adoc

Lines changed: 5 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
[[http-api-begin-and-commit-a-transaction-in-one-request]]
44
= Begin and commit a transaction in one request
55

6-
== Begin and commit request
7-
86
If there is no need to keep a transaction open across multiple HTTP requests, you can begin a transaction, execute statements, and commit within a single HTTP request.
97

108
_Example request_
119

12-
* *+POST+* +http://localhost:7474/db/neo4j/tx/commit+
10+
* *+POST+* +http://localhost:7474/db/data/transaction/commit+
1311
* *+Accept:+* +application/json;charset=UTF-8+
1412
* *+Content-Type:+* +application/json+
1513

@@ -18,10 +16,7 @@ _Example request_
1816
{
1917
"statements": [
2018
{
21-
"statement": "MATCH (n) WHERE id(n) = $nodeId RETURN n",
22-
"parameters": {
23-
"nodeId": 7
24-
}
19+
"statement": "CREATE (n) RETURN id(n)"
2520
}
2621
]
2722
}
@@ -30,74 +25,16 @@ _Example request_
3025
_Example response_
3126

3227
* *+200:+* +OK+
33-
* *+Content-Type:+* +application/json;charset=utf-8+
34-
35-
[source, JSON, role="nocopy"]
36-
----
37-
{
38-
"results" : [ {
39-
"columns" : [ "n" ],
40-
"data" : [ {
41-
"row" : [ { } ],
42-
"meta" : [ {
43-
"id" : 7,
44-
"type" : "node",
45-
"deleted" : false
46-
} ]
47-
} ]
48-
} ],
49-
"errors" : [ ]
50-
}
51-
----
52-
53-
54-
== Legacy Endpoints label:deprecated[]
55-
56-
[IMPORTANT]
57-
====
58-
The API described in this section of the manual has been deprecated and will be removed in Neo4j 5.0.
59-
====
60-
61-
Starting with Neo4j version 4.3, statements submitted via these endpoints will be processed by the user's respective _home database_.
62-
Previous versions rely on the the globally configured _default database_.
63-
64-
_Example request_
65-
66-
* *+POST+* +http://localhost:7474/db/neo4j/tx/commit+
67-
* *+Accept:+* +application/json;charset=UTF-8+
6828
* *+Content-Type:+* +application/json+
6929

70-
[source, JSON, role="nocopy"]
71-
----
72-
{
73-
"statements": [
74-
{
75-
"statement": "MATCH (n) WHERE id(n) = $nodeId RETURN n",
76-
"parameters": {
77-
"nodeId": 2
78-
}
79-
}
80-
]
81-
}
82-
----
83-
84-
_Example response_
85-
86-
* *+200:+* +OK+
87-
* *+Content-Type:+* +application/json;charset=utf-8+
88-
8930
[source, JSON, role="nocopy"]
9031
----
9132
{
9233
"results" : [ {
93-
"columns" : [ "n" ],
34+
"columns" : [ "id(n)" ],
9435
"data" : [ {
95-
"row" : [ { } ],
96-
"meta" : [ {
97-
"id" : 2,
98-
"type" : "node",
99-
"deleted" : false
100-
} ]
36+
"row" : [ 6 ],
37+
"meta" : [ null ]
10138
} ]
10239
} ],
10340
"errors" : [ ]

modules/ROOT/pages/actions/commit-an-open-transaction.adoc

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
:description: Commit a transaction.
22

33
[[http-api-commit-an-open-transaction]]
4-
= Commit a transaction
4+
= Commit an open transaction
55

6-
When you have executed all the statements for the transaction, and want to commit the changes to the database, you can use `POST db/\{name}/tx/\{txid}/commit`, which can also include any final statements to execute before committing.
6+
Given you have an open transaction, you can send a commit request.
7+
Optionally, you can submit additional statements along with the request that will be executed before committing the transaction.
78

89
_Example request_
910

10-
* *+POST+* +http://localhost:7474/db/neo4j/tx/2/commit+
11+
* *+POST+* +http://localhost:7474/db/data/transaction/6/commit+
1112
* *+Accept:+* +application/json;charset=UTF-8+
1213
* *+Content-Type:+* +application/json+
1314

@@ -16,10 +17,7 @@ _Example request_
1617
{
1718
"statements": [
1819
{
19-
"statement": "MATCH (n) WHERE id(n) = $nodeId RETURN n",
20-
"parameters": {
21-
"nodeId": 6
22-
}
20+
"statement": "CREATE (n) RETURN id(n)"
2321
}
2422
]
2523
}
@@ -28,20 +26,16 @@ _Example request_
2826
_Example response_
2927

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

3331
[source, JSON, role="nocopy"]
3432
----
3533
{
3634
"results" : [ {
37-
"columns" : [ "n" ],
35+
"columns" : [ "id(n)" ],
3836
"data" : [ {
39-
"row" : [ { } ],
40-
"meta" : [ {
41-
"id" : 6,
42-
"type" : "node",
43-
"deleted" : false
44-
} ]
37+
"row" : [ 5 ],
38+
"meta" : [ null ]
4539
} ]
4640
} ],
4741
"errors" : [ ]

modules/ROOT/pages/actions/execute-multiple-statements.adoc

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The response will contain the result of each statement.
88

99
_Example request_
1010

11-
* *+POST+* +http://localhost:7474/db/neo4j/tx/commit+
11+
* *+POST+* +http://localhost:7474/db/data/transaction/commit+
1212
* *+Accept:+* +application/json;charset=UTF-8+
1313
* *+Content-Type:+* +application/json+
1414

@@ -17,9 +17,14 @@ _Example request_
1717
{
1818
"statements": [
1919
{
20-
"statement": "MATCH (n) WHERE id(n) = $nodeId RETURN n",
20+
"statement": "CREATE (n) RETURN id(n)"
21+
},
22+
{
23+
"statement": "CREATE (n $props) RETURN n",
2124
"parameters": {
22-
"nodeId": 3
25+
"props": {
26+
"name": "My Node"
27+
}
2328
}
2429
}
2530
]
@@ -29,15 +34,23 @@ _Example request_
2934
_Example response_
3035

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

34-
[source,javascript]
39+
[source, JSON, role="nocopy"]
3540
----
3641
{
3742
"results" : [ {
43+
"columns" : [ "id(n)" ],
44+
"data" : [ {
45+
"row" : [ 2 ],
46+
"meta" : [ null ]
47+
} ]
48+
}, {
3849
"columns" : [ "n" ],
3950
"data" : [ {
40-
"row" : [ { } ],
51+
"row" : [ {
52+
"name" : "My Node"
53+
} ],
4154
"meta" : [ {
4255
"id" : 3,
4356
"type" : "node",
Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
:description: Run queries in a transaction.
22

33
[[http-api-execute-statements-in-an-open-transaction]]
4-
= Run queries inside a transaction
4+
= Execute statements in an open transaction
55

6-
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.
7-
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.
6+
Given that you have an open transaction, you can make a number of requests, each of which executes additional statements, and keep the transaction open by resetting the transaction timeout.
87

98
_Example request_
109

11-
* *+POST+* +http://localhost:7474/db/neo4j/tx/18+
10+
* *+POST+* +http://localhost:7474/db/data/transaction/12+
1211
* *+Accept:+* +application/json;charset=UTF-8+
1312
* *+Content-Type:+* +application/json+
1413

@@ -26,27 +25,27 @@ _Example request_
2625
_Example response_
2726

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

3130
[source, JSON, role="nocopy"]
3231
----
3332
{
33+
"commit" : "http://localhost:7474/db/data/transaction/12/commit",
3434
"results" : [ {
3535
"columns" : [ "n" ],
3636
"data" : [ {
3737
"row" : [ { } ],
3838
"meta" : [ {
39-
"id" : 12,
39+
"id" : 11,
4040
"type" : "node",
4141
"deleted" : false
4242
} ]
4343
} ]
4444
} ],
45-
"errors" : [ ],
46-
"commit" : "http://localhost:7474/db/neo4j/tx/18/commit",
4745
"transaction" : {
48-
"expires" : "Mon, 20 Sep 2021 07:57:38 GMT"
49-
}
46+
"expires" : "Mon, 27 Sep 2021 08:28:00 +0000"
47+
},
48+
"errors" : [ ]
5049
}
5150
----
5251

0 commit comments

Comments
 (0)