|
@@ -37,7 +37,9 @@ $config = array(
|
37
|
37
|
);
|
38
|
38
|
```
|
39
|
39
|
|
40
|
|
-## Example output
|
|
40
|
+## Usage
|
|
41
|
+
|
|
42
|
+You can do all CRUD (Create, Read, Update, Delete) operations and extra List operation. Here is how:
|
41
|
43
|
|
42
|
44
|
### List
|
43
|
45
|
|
|
@@ -76,6 +78,17 @@ GET http://localhost/api/categories?filter=id:2&match=lower
|
76
|
78
|
{"categories":{"columns":["id","name"],"records":[["1","Internet"]]}}
|
77
|
79
|
```
|
78
|
80
|
|
|
81
|
+### Create
|
|
82
|
+
|
|
83
|
+```
|
|
84
|
+POST http://localhost/api/categories
|
|
85
|
+{"id":"1","name":"Internet"}
|
|
86
|
+```
|
|
87
|
+
|
|
88
|
+```
|
|
89
|
+1
|
|
90
|
+``
|
|
91
|
+
|
79
|
92
|
### Read
|
80
|
93
|
|
81
|
94
|
```
|
|
@@ -86,6 +99,27 @@ GET http://localhost/api/categories/1
|
86
|
99
|
{"id":"1","name":"Internet"}
|
87
|
100
|
```
|
88
|
101
|
|
|
102
|
+### Update
|
|
103
|
+
|
|
104
|
+```
|
|
105
|
+PUT http://localhost/api/categories/2
|
|
106
|
+{"id":"1","name":"Internet networking"}
|
|
107
|
+```
|
|
108
|
+
|
|
109
|
+```
|
|
110
|
+1
|
|
111
|
+``
|
|
112
|
+
|
|
113
|
+### Delete
|
|
114
|
+
|
|
115
|
+```
|
|
116
|
+DELETE http://localhost/api/categories/2
|
|
117
|
+```
|
|
118
|
+
|
|
119
|
+```
|
|
120
|
+1
|
|
121
|
+```
|
|
122
|
+
|
89
|
123
|
## Installation
|
90
|
124
|
|
91
|
125
|
Put the files in a folder named "api" and edit config.php.dist and rename it to config.php. Let Apache serve the parent folder or configure the .htaccess RewriteBase to match the exposed part of the path.
|