|
@@ -28,7 +28,6 @@ This is a single file application! Upload "api.php" somewhere and enjoy!
|
28
|
28
|
- Complex filters (with both "and" & "or") are not supported
|
29
|
29
|
- Complex writes (transactions) are not supported
|
30
|
30
|
- Complex queries calling functions (like "concat" or "sum") are not supported
|
31
|
|
- - Batch operations for insert, update and delete are not supported
|
32
|
31
|
- Binary and spatial/GIS functionality is not supported in SQLite
|
33
|
32
|
|
34
|
33
|
## Features
|
|
@@ -38,6 +37,7 @@ This is a single file application! Upload "api.php" somewhere and enjoy!
|
38
|
37
|
- Streaming data, low memory footprint
|
39
|
38
|
- Supports POST variables as input
|
40
|
39
|
- Supports a JSON object as input
|
|
40
|
+ - Supports a JSON array as input (batch insert)
|
41
|
41
|
- Condensed JSON ouput: first row contains field names
|
42
|
42
|
- Sanitize and validate input using callbacks
|
43
|
43
|
- Permission system for databases, tables, columns and records
|
|
@@ -256,7 +256,7 @@ Output:
|
256
|
256
|
|
257
|
257
|
Note that the fields that are not specified in the request get the default value as specified in the database.
|
258
|
258
|
|
259
|
|
-### Create (with JSON)
|
|
259
|
+### Create (with JSON object)
|
260
|
260
|
|
261
|
261
|
Alternatively you can send a JSON object in the body. The call returns the "last insert id".
|
262
|
262
|
|
|
@@ -273,6 +273,23 @@ Output:
|
273
|
273
|
|
274
|
274
|
Note that the fields that are not specified in the request get the default value as specified in the database.
|
275
|
275
|
|
|
276
|
+### Create (with JSON array)
|
|
277
|
+
|
|
278
|
+Alternatively you can send a JSON array containing multiple JSON objects in the body. The call returns an array of "last insert id" values.
|
|
279
|
+
|
|
280
|
+```
|
|
281
|
+POST http://localhost/api.php/categories
|
|
282
|
+[{"name":"Internet"},{"name":"Programming"},{"name":"Web development"}]
|
|
283
|
+```
|
|
284
|
+
|
|
285
|
+Output:
|
|
286
|
+
|
|
287
|
+```
|
|
288
|
+[1,2,3]
|
|
289
|
+```
|
|
290
|
+
|
|
291
|
+This call uses a transaction and will either insert all or no records. If no records are inserted it will return 'null'.
|
|
292
|
+
|
276
|
293
|
### Read
|
277
|
294
|
|
278
|
295
|
If you want to read a single object you can use:
|