@@ -15,27 +15,21 @@ paths:
15
15
description: |
16
16
Load JSON data and store it as documents into the specified collection.
17
17
18
- The request body can have different JSON formats:
19
- - One JSON object per line (JSONL)
20
- - A JSON array of objects
21
- - One JSON array per line (CSV-like)
22
-
23
18
If you import documents into edge collections, all documents require a `_from`
24
19
and a `_to` attribute.
25
20
requestBody:
26
21
content:
27
- application/json :
22
+ 'text/plain; charset=utf-8' :
28
23
schema:
29
- type: object
30
- required:
31
- - documents
32
- properties:
33
- documents:
34
- description: |
35
- The body must either be a JSON-encoded array of objects or a string with
36
- multiple JSON objects separated by newlines.
37
- type: string
24
+ description: |
25
+ The request body can have different JSON formats depending on
26
+ the `type` parameter:
27
+ - One JSON object per line (JSONL)
28
+ - A JSON array of objects
29
+ - One JSON array per line (CSV-like)
38
30
parameters:
31
+ # Purposefully undocumented:
32
+ # line (compensate for arangoimport --skip-lines in error messages)
39
33
- name: database-name
40
34
in: path
41
35
required: true
86
80
87
81
- `auto`: automatically determines the type (either `documents` or `array`).
88
82
89
- - Omit the `type` parameter entirely to import JSON arrays of tabular data,
90
- similar to CSV.
83
+ - Omit the `type` parameter entirely (or set it to an empty string)
84
+ to import JSON arrays of tabular data, similar to CSV.
91
85
92
86
The first line is an array of strings that defines the attribute keys. The
93
87
subsequent lines are arrays with the attribute values. The keys and values
@@ -102,40 +96,72 @@ paths:
102
96
```
103
97
schema:
104
98
type: string
99
+ enum: ["", documents, array, auto]
100
+ default: ""
101
+ - name: ignoreMissing
102
+ in: query
103
+ required: false
104
+ description: |
105
+ When importing JSON arrays of tabular data (`type` parameter is omitted),
106
+ the first line of the request body defines the attribute keys and the
107
+ subsequent lines the attribute values for each document. Subsequent lines
108
+ with a different number of elements than the first line are not imported
109
+ by default.
110
+
111
+ ```js
112
+ ["attr1", "attr2"]
113
+ [1, 2] // matching number of elements
114
+ [1] // misses 2nd element
115
+ [1, 2, 3] // excess 3rd element
116
+ ```
117
+
118
+ You can enable this option to import them anyway. For the missing elements,
119
+ the document attributes are omitted. Excess elements are ignored.
120
+ schema:
121
+ type: boolean
122
+ default: false
105
123
- name: fromPrefix
106
124
in: query
107
125
required: false
108
126
description: |
109
- An optional prefix for the values in `_from` attributes. If specified, the
110
- value is automatically prepended to each `_from` input value. This allows
111
- specifying just the keys for `_from`.
127
+ The collection name prefix to prepend to all values in the `_from`
128
+ attribute that only specify a document key.
112
129
schema:
113
130
type: string
114
131
- name: toPrefix
115
132
in: query
116
133
required: false
117
134
description: |
118
- An optional prefix for the values in `_to` attributes. If specified, the
119
- value is automatically prepended to each `_to` input value. This allows
120
- specifying just the keys for `_to`.
135
+ The collection name prefix to prepend to all values in the `_to`
136
+ attribute that only specify a document key.
121
137
schema:
122
138
type: string
139
+ - name: overwriteCollectionPrefix
140
+ in: query
141
+ required: false
142
+ description: |
143
+ Force the `fromPrefix` and `toPrefix`, possibly replacing existing
144
+ collection name prefixes.
145
+ schema:
146
+ type: boolean
147
+ default: false
123
148
- name: overwrite
124
149
in: query
125
150
required: false
126
151
description: |
127
- If this parameter has a value of `true` or `yes`, then all data in the
128
- collection will be removed prior to the import. Note that any existing
129
- index definitions will be preserved.
152
+ If enabled, then all data in the collection is removed prior to the
153
+ import. Any existing index definitions are preserved.
130
154
schema:
131
155
type: boolean
156
+ default: false
132
157
- name: waitForSync
133
158
in: query
134
159
required: false
135
160
description: |
136
161
Wait until documents have been synced to disk before returning.
137
162
schema:
138
163
type: boolean
164
+ default: false
139
165
- name: onDuplicate
140
166
in: query
141
167
required: false
@@ -159,6 +185,7 @@ paths:
159
185
schema:
160
186
type: string
161
187
enum: [error, update, replace, ignore]
188
+ default: error
162
189
- name: complete
163
190
in: query
164
191
required: false
@@ -168,6 +195,7 @@ paths:
168
195
skipping the problematic documents.
169
196
schema:
170
197
type: boolean
198
+ default: false
171
199
- name: details
172
200
in: query
173
201
required: false
@@ -176,6 +204,7 @@ paths:
176
204
about documents that could not be imported.
177
205
schema:
178
206
type: boolean
207
+ default: false
179
208
responses:
180
209
'201':
181
210
description: |
@@ -225,21 +254,22 @@ paths:
225
254
type: string
226
255
'400':
227
256
description: |
228
- is returned if `type` contains an invalid value, no `collection` is
257
+ The `type` contains an invalid value, no `collection` is
229
258
specified, the documents are incorrectly encoded, or the request
230
259
is malformed.
231
260
'404':
232
261
description: |
233
- is returned if `collection` or the `_from` or `_to` attributes of an
262
+ The `collection` parameter or the `_from` or `_to` attributes of an
234
263
imported edge refer to an unknown collection.
235
264
'409':
236
265
description: |
237
- is returned if the import would trigger a unique key violation and
238
- `complete` is set to `true` .
266
+ The `complete` option is enabled and the import triggers a
267
+ unique key violation .
239
268
'500':
240
269
description: |
241
- is returned if the server cannot auto-generate a document key (out of keys
242
- error) for a document with no user-defined key.
270
+ The `complete` option is enabled and the input is invalid,
271
+ or the server cannot auto-generate a document key (out of keys error)
272
+ for a document with no user-defined key.
243
273
tags:
244
274
- Import
245
275
```
0 commit comments