Sfoglia il codice sorgente

Merge branch 'master' of github.com:mevdschee/mysql-crud-api

Maurits van der Schee 10 anni fa
parent
commit
0c0858dbc0
1 ha cambiato i file con 30 aggiunte e 3 eliminazioni
  1. 30
    3
      README.md

+ 30
- 3
README.md Vedi File

@@ -11,7 +11,7 @@ Simple PHP script that adds a very basic API to a MySQL database
11 11
 
12 12
   - Public API only: no authentication or authorization
13 13
   - Read-only: no write or delete supported
14
-  - No pagination or column selection: always returns full table
14
+  - No column selection: always returns full table
15 15
   - Single database
16 16
 
17 17
 ## Features
@@ -22,6 +22,7 @@ Simple PHP script that adds a very basic API to a MySQL database
22 22
   - Optional white- and blacklist support for tables
23 23
   - JSONP support for cross-domain requests
24 24
   - Combined requests with wildcard support for table names
25
+  - Pagination and search support
25 26
 
26 27
 ## Configuration
27 28
 
@@ -31,8 +32,10 @@ $config = array(
31 32
     "username"=>"root",
32 33
     "password"=>"root",
33 34
     "database"=>"blog",
34
-    "whitelist"=>false,
35
-    "blacklist"=>array("users"),
35
+    "read_whitelist"=>false,
36
+    "read_blacklist"=>array("users"),
37
+    "list_whitelist"=>false,
38
+    "list_blacklist"=>array("users"),
36 39
 );
37 40
 ```
38 41
 
@@ -51,6 +54,30 @@ GET http://localhost/api/cate*,user*
51 54
 {"categories":{"columns":["id","name"],"records":[["1","Internet"],["3","Web development"]]}}
52 55
 ```
53 56
 
57
+### List + Pagination
58
+
59
+```
60
+GET http://localhost/api/categories?page=1
61
+GET http://localhost/api/categories?page=1:50
62
+```
63
+
64
+```
65
+{"categories":{"pages":"1","columns":["id","name"],"records":[["1","Internet"],["3","Web development"]]}}
66
+```
67
+
68
+### List + Filter
69
+
70
+```
71
+GET http://localhost/api/categories?filter=name:Inter
72
+GET http://localhost/api/categories?filter=name:Internet&match=exact
73
+GET http://localhost/api/categories?filter=id:1&match=upto
74
+GET http://localhost/api/categories?filter=id:2&match=lower
75
+```
76
+
77
+```
78
+{"categories":{"pages":"1","columns":["id","name"],"records":[["1","Internet"]]}}
79
+```
80
+
54 81
 ### Read
55 82
 
56 83
 ```

Loading…
Annulla
Salva