Skip to content

Commit 5b468c7

Browse files
committed
Add PATCH support for incrementing
1 parent 7ec8dfb commit 5b468c7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ This is a single file application! Upload "api.php" somewhere and enjoy!
5151
- Pagination, sorting and column selection
5252
- Relation detection and filtering on foreign keys
5353
- Relation "transforms" for PHP and JavaScript
54+
- Atomic increment and decrement support via PATCH
5455
- Binary fields supported with base64 encoding
5556
- Spatial/GIS fields and filters supported with WKT
5657
- Generate API documentation using Swagger tools
@@ -627,6 +628,25 @@ The code also supports multi-database API's. These have URLs where the first seg
627628
This can be enabled by NOT specifying a database in the configuration. Also the permissions in the configuration should contain a dot
628629
character to seperate the database from the table name. The databases 'mysql', 'information_schema' and 'sys' are automatically blocked.
629630

631+
## Atomic increment
632+
633+
Incrementing a numeric field of a record is done with the PATCH method.
634+
Decrementing can be done using a negative increment value.
635+
The call returns the rows affected.
636+
637+
```
638+
PATCH http://localhost/api.php/events/1
639+
visitors=1
640+
```
641+
642+
Output:
643+
644+
```
645+
1
646+
```
647+
648+
Note that non-numeric fields will not be affected.
649+
630650
## Binary data
631651

632652
Binary fields are automatically detected and data in those fields is returned using base64 encoding.

0 commit comments

Comments
 (0)