@ -87,6 +87,13 @@ Add an IP to iptables. iptables or ip6tables will be chosen based on the IP.
* **Auth**: None
* **Auth**: None
* **RESPONSE**: 200/4xx/5xx
* **RESPONSE**: 200/4xx/5xx
or
* **URL**: `/`
* **METHOD**: `POST`
* **Auth**: None
* **RESPONSE**: 200/4xx/5xx
#### Add/Block Success Examples
#### Add/Block Success Examples
* GET `/addip/1.2.3.4`
* 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.
{"success":"added"}
{"success":"added"}
```
```
* POST `/` with `{"ipaddress":"1.2.3.4"}`
* RESPONSE `200 OK`
```json
{"success":"added"}
```
#### Add/Block Error Examples
#### Add/Block Error Examples
* GET `/addip/1.2.3`
* GET `/addip/1.2.3`
@ -119,6 +133,13 @@ Add an IP to iptables. iptables or ip6tables will be chosen based on the IP.
{"error":"only valid ip addresses supported"}
{"error":"only valid ip addresses supported"}
```
```
* POST `/` with `{"address":"1.2.3.4"}`
* RESPONSE `400 Bad Request`
```json
{"error":"ipaddress is missing. "}
```
### Remove/Unblock IP
### Remove/Unblock IP
Remove an IP from iptables. iptables or ip6tables will be chosen based on the IP.
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
* RESPONSE `200 OK`
* RESPONSE `200 OK`
```json
```json
{"success":"removed"}
{"success":"deleted"}
```
```
* GET `/unblockip/2001:db8:3333:4444:5555:6666:7777:8888`
* GET `/unblockip/2001:db8:3333:4444:5555:6666:7777:8888`
* RESPONSE `200 OK`
* RESPONSE `200 OK`
```json
```json
{"success":"removed"}
{"success":"deleted"}
```
* DELETE `/` with `{"ipaddress":"1.2.3.4"}`
* RESPONSE `200 OK`
```json
{"success":"deleted"}
```
```
#### Remove/Unblock Error Examples
#### Remove/Unblock Error Examples
@ -160,6 +188,13 @@ Remove an IP from iptables. iptables or ip6tables will be chosen based on the IP
{"error":"only valid ip addresses supported"}
{"error":"only valid ip addresses supported"}
```
```
* DELETE `/` with `{"address":"1.2.3.4"}`
* RESPONSE `400 Bad Request`
```json
{"error":"ipaddress is missing. "}
```
### Flush APIBANLOCAL chain
### Flush APIBANLOCAL chain
Flushes the iptables and ip6tables APIBANLOCAL chain.
Flushes the iptables and ip6tables APIBANLOCAL chain.
@ -175,10 +210,10 @@ Flushes the iptables and ip6tables APIBANLOCAL chain.
* RESPONSE `200 OK`
* RESPONSE `200 OK`
```json
```json
{"success":"flushed"}
{"result":"ipv4 flushed. ipv6 flushed. "}
```
```
#### Flush Error Example
#### Flush Error Examples
* GET `/flushchain`
* GET `/flushchain`
* RESPONSE `500 Internal Server Error`
* RESPONSE `500 Internal Server Error`
@ -187,6 +222,13 @@ Flushes the iptables and ip6tables APIBANLOCAL chain.
{"error":"error initializing iptables"}
{"error":"error initializing iptables"}
```
```
* GET `/flushchain`
* RESPONSE `200 OK`
```json
{"result":"ipv4 error. ipv6 flushed. "}
```
## License / Warranty
## License / Warranty
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
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