The functionality allows you to create lists for blocking requests based on the IP address of the request source.
Settings are managed using specially designed queries. The general conventions (authorization, response codes, the *_hash methods and paginated selection) are described in the relevant section.
The general rules for writing the value of a host apply to the host parameter of an element of the list. The port cannot be used.
Examples of the value of the host parameter:
"host": "example.com"
"host": "*.example.com"
"host": "10.10.10.1"
"host": "[fe80:0:0:0:200:f8ff:fe21:67cf]"
Request example:
curl http://api.example.com:8080/filter/v1/get_bl --header 'Content-type: application/json' --data '{"key": "%PRODUCT KEY%"}'
Response format:
{
"status": "success",
"active": boolean,
"timestamp": integer,
"bl": [object, ...]
}
or (in the case where data is missing)
{"status": "none"}
or (in case of an error)
{"status": "fail", "description": "%DESCRIPTION%"}
Response example:
{
"status": "success",
"active": true,
"timestamp": 1719335019,
"bl": [
{"host": "example.com", "ip": "10.10.10.1", "api": true},
...
]
}
active - if the value is false, the settings are deactivated;timestamp - the date of the last configuration change in the Unix Timestamp format.Request example:
curl http://api.example.com:8080/filter/v1/set_bl --header 'Content-type: application/json' --data '{
"key": "%PRODUCT KEY%",
"set": {
"active": true,
"bl": [
{"host": "example.com", "ip": "10.10.10.1"},
{"ip": "11.11.11.11"},
{"ip": "12.12.12.0/24"},
{"ip": "13.13.13.13-14.14.14.14", "api": true}
]
}
}'
active - if the value is false, the settings are deactivated;
api - activation of sending blocking events when accessing from the specified IP address in the API. If the parameter is omitted, the default value is false.
Requests from the IP address 10.10.10.1 will be blocked only for the host example.com. Requests from IP addresses 11.11.11.11, 12.12.12.0/24 and 13.13.13.13-14.14.14.14 will be blocked for all hosts, including example.com.
The general rule for writing values applies to the host parameter.
curl http://api.example.com:8080/filter/v1/set_bl --header 'Content-type: application/json' --data '{
"key": "%PRODUCT KEY%",
"set": {
"active": true,
"bl": [
{"ip": "10.10.10.1"},
{"ip": "10.10.10.1", "api": true},
{"host": "example.com", "ip": "10.10.10.1"},
{"host": "10.0.0.1", "ip": "10.10.10.1"},
{"host": "[fe80:0:0:0:200:f8ff:fe21:67cf]", "ip": "10.10.10.1"},
{"host": "[fe80:0:0:0:200:f8ff:fe21:67cf]", "ip": "fe80:0:0:0:200:f8ff:fe21:67cf", "api": true}
]
}
}'
Response example:
{"status": "success"}
or (in case of an error)
{"status": "fail", "description": "%DESCRIPTION%"}
The method allows you to check whether the data has changed without downloading it in full. More detailed information is available in the relevant section.
Request example:
curl http://api.example.com:8080/filter/v1/get_bl_hash --header 'Content-type: application/json' --data '{"key": "%PRODUCT KEY%"}'
Response example:
{"status": "success", "hash": "8ddd2b342d3190a866ee35afb249919a"}
or (in the case where data is missing)
{"status": "none"}
or (in case of an error)
{"status": "fail", "description": "%DESCRIPTION%"}
Request example:
curl http://api.example.com:8080/filter/v1/set_bl --header 'Content-type: application/json' --data '{
"key": "%PRODUCT KEY%",
"del": ""
}'
Response example:
{"status": "success"}
or (in case of an error)
{"status": "fail", "description": "%DESCRIPTION%"}