You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+46-4Lines changed: 46 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,6 +87,13 @@ Add an IP to iptables. iptables or ip6tables will be chosen based on the IP.
87
87
***Auth**: None
88
88
***RESPONSE**: 200/4xx/5xx
89
89
90
+
or
91
+
92
+
***URL**: `/`
93
+
***METHOD**: `POST`
94
+
***Auth**: None
95
+
***RESPONSE**: 200/4xx/5xx
96
+
90
97
#### Add/Block Success Examples
91
98
92
99
* GET `/addip/1.2.3.4`
@@ -103,6 +110,13 @@ Add an IP to iptables. iptables or ip6tables will be chosen based on the IP.
103
110
{"success":"added"}
104
111
```
105
112
113
+
* POST `/` with `{"ipaddress":"1.2.3.4"}`
114
+
* RESPONSE `200 OK`
115
+
116
+
```json
117
+
{"success":"added"}
118
+
```
119
+
106
120
#### Add/Block Error Examples
107
121
108
122
* GET `/addip/1.2.3`
@@ -119,6 +133,13 @@ Add an IP to iptables. iptables or ip6tables will be chosen based on the IP.
119
133
{"error":"only valid ip addresses supported"}
120
134
```
121
135
136
+
* POST `/` with `{"address":"1.2.3.4"}`
137
+
* RESPONSE `400 Bad Request`
138
+
139
+
```json
140
+
{"error":"ipaddress is missing. "}
141
+
```
142
+
122
143
### Remove/Unblock IP
123
144
124
145
Remove an IP from iptables. iptables or ip6tables will be chosen based on the IP.
@@ -134,14 +155,21 @@ Remove an IP from iptables. iptables or ip6tables will be chosen based on the IP
134
155
* RESPONSE `200 OK`
135
156
136
157
```json
137
-
{"success":"removed"}
158
+
{"success":"deleted"}
138
159
```
139
160
140
161
* GET `/unblockip/2001:db8:3333:4444:5555:6666:7777:8888`
141
162
* RESPONSE `200 OK`
142
163
143
164
```json
144
-
{"success":"removed"}
165
+
{"success":"deleted"}
166
+
```
167
+
168
+
* DELETE `/` with `{"ipaddress":"1.2.3.4"}`
169
+
* RESPONSE `200 OK`
170
+
171
+
```json
172
+
{"success":"deleted"}
145
173
```
146
174
147
175
#### Remove/Unblock Error Examples
@@ -160,6 +188,13 @@ Remove an IP from iptables. iptables or ip6tables will be chosen based on the IP
160
188
{"error":"only valid ip addresses supported"}
161
189
```
162
190
191
+
* DELETE `/` with `{"address":"1.2.3.4"}`
192
+
* RESPONSE `400 Bad Request`
193
+
194
+
```json
195
+
{"error":"ipaddress is missing. "}
196
+
```
197
+
163
198
### Flush APIBANLOCAL chain
164
199
165
200
Flushes the iptables and ip6tables APIBANLOCAL chain.
@@ -175,10 +210,10 @@ Flushes the iptables and ip6tables APIBANLOCAL chain.
175
210
* RESPONSE `200 OK`
176
211
177
212
```json
178
-
{"success":"flushed"}
213
+
{"result":"ipv4 flushed. ipv6 flushed. "}
179
214
```
180
215
181
-
#### Flush Error Example
216
+
#### Flush Error Examples
182
217
183
218
* GET `/flushchain`
184
219
* RESPONSE `500 Internal Server Error`
@@ -187,6 +222,13 @@ Flushes the iptables and ip6tables APIBANLOCAL chain.
187
222
{"error":"error initializing iptables"}
188
223
```
189
224
225
+
* GET `/flushchain`
226
+
* RESPONSE `200 OK`
227
+
228
+
```json
229
+
{"result":"ipv4 error. ipv6 flushed. "}
230
+
```
231
+
190
232
## License / Warranty
191
233
192
234
iptables-api is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version
0 commit comments