curl --request POST \
--url https://management-api.fpjs.io/filtering-rules/test \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-API-Version: <x-api-version>' \
--data @- <<EOF
{
"rules": [
{
"expression": "http.request.ip in cidr('192.168.1.1/32')",
"action": "deny",
"deny_with": "Forbidden"
}
],
"environment": "ae_rrETjdWcfqI6AFsk",
"test_request_id": "req_abc123xyz",
"test_request_payload": {
"headers": {
"user-agent": [
"Mozilla/5.0"
],
"accept": [
"application/json"
]
},
"ip": "192.168.1.1",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
"sdkPlatform": "js",
"sdkVersion": "3.8.0",
"appPackageName": "com.example.app"
}
}
EOFimport requests
url = "https://management-api.fpjs.io/filtering-rules/test"
payload = {
"rules": [
{
"expression": "http.request.ip in cidr('192.168.1.1/32')",
"action": "deny",
"deny_with": "Forbidden"
}
],
"environment": "ae_rrETjdWcfqI6AFsk",
"test_request_id": "req_abc123xyz",
"test_request_payload": {
"headers": {
"user-agent": ["Mozilla/5.0"],
"accept": ["application/json"]
},
"ip": "192.168.1.1",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
"sdkPlatform": "js",
"sdkVersion": "3.8.0",
"appPackageName": "com.example.app"
}
}
headers = {
"X-API-Version": "<x-api-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-API-Version': '<x-api-version>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
rules: [
{
expression: 'http.request.ip in cidr(\'192.168.1.1/32\')',
action: 'deny',
deny_with: 'Forbidden'
}
],
environment: 'ae_rrETjdWcfqI6AFsk',
test_request_id: 'req_abc123xyz',
test_request_payload: {
headers: {'user-agent': ['Mozilla/5.0'], accept: ['application/json']},
ip: '192.168.1.1',
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
sdkPlatform: 'js',
sdkVersion: '3.8.0',
appPackageName: 'com.example.app'
}
})
};
fetch('https://management-api.fpjs.io/filtering-rules/test', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://management-api.fpjs.io/filtering-rules/test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'rules' => [
[
'expression' => 'http.request.ip in cidr(\'192.168.1.1/32\')',
'action' => 'deny',
'deny_with' => 'Forbidden'
]
],
'environment' => 'ae_rrETjdWcfqI6AFsk',
'test_request_id' => 'req_abc123xyz',
'test_request_payload' => [
'headers' => [
'user-agent' => [
'Mozilla/5.0'
],
'accept' => [
'application/json'
]
],
'ip' => '192.168.1.1',
'userAgent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
'sdkPlatform' => 'js',
'sdkVersion' => '3.8.0',
'appPackageName' => 'com.example.app'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-API-Version: <x-api-version>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://management-api.fpjs.io/filtering-rules/test"
payload := strings.NewReader("{\n \"rules\": [\n {\n \"expression\": \"http.request.ip in cidr('192.168.1.1/32')\",\n \"action\": \"deny\",\n \"deny_with\": \"Forbidden\"\n }\n ],\n \"environment\": \"ae_rrETjdWcfqI6AFsk\",\n \"test_request_id\": \"req_abc123xyz\",\n \"test_request_payload\": {\n \"headers\": {\n \"user-agent\": [\n \"Mozilla/5.0\"\n ],\n \"accept\": [\n \"application/json\"\n ]\n },\n \"ip\": \"192.168.1.1\",\n \"userAgent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36\",\n \"sdkPlatform\": \"js\",\n \"sdkVersion\": \"3.8.0\",\n \"appPackageName\": \"com.example.app\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Version", "<x-api-version>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://management-api.fpjs.io/filtering-rules/test")
.header("X-API-Version", "<x-api-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rules\": [\n {\n \"expression\": \"http.request.ip in cidr('192.168.1.1/32')\",\n \"action\": \"deny\",\n \"deny_with\": \"Forbidden\"\n }\n ],\n \"environment\": \"ae_rrETjdWcfqI6AFsk\",\n \"test_request_id\": \"req_abc123xyz\",\n \"test_request_payload\": {\n \"headers\": {\n \"user-agent\": [\n \"Mozilla/5.0\"\n ],\n \"accept\": [\n \"application/json\"\n ]\n },\n \"ip\": \"192.168.1.1\",\n \"userAgent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36\",\n \"sdkPlatform\": \"js\",\n \"sdkVersion\": \"3.8.0\",\n \"appPackageName\": \"com.example.app\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://management-api.fpjs.io/filtering-rules/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Version"] = '<x-api-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"rules\": [\n {\n \"expression\": \"http.request.ip in cidr('192.168.1.1/32')\",\n \"action\": \"deny\",\n \"deny_with\": \"Forbidden\"\n }\n ],\n \"environment\": \"ae_rrETjdWcfqI6AFsk\",\n \"test_request_id\": \"req_abc123xyz\",\n \"test_request_payload\": {\n \"headers\": {\n \"user-agent\": [\n \"Mozilla/5.0\"\n ],\n \"accept\": [\n \"application/json\"\n ]\n },\n \"ip\": \"192.168.1.1\",\n \"userAgent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36\",\n \"sdkPlatform\": \"js\",\n \"sdkVersion\": \"3.8.0\",\n \"appPackageName\": \"com.example.app\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"result": "deny",
"deny_with": "Forbidden",
"triggered_rule": "http.request.ip in cidr('192.168.1.1/32')"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"violations": [
{
"property": "<string>",
"message": "<string>"
}
]
}
}{
"error": {
"message": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"violations": [
{
"property": "<string>",
"message": "<string>"
}
]
}
}{
"error": {
"message": "<string>",
"code": "<string>"
}
}Test filtering rules
Tests filtering rules against a specified request ID or custom event payload. You can provide an existing request ID (up to 3 months old) or a custom JSON payload. Optionally, you can provide custom rules to test instead of using existing rules.
curl --request POST \
--url https://management-api.fpjs.io/filtering-rules/test \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-API-Version: <x-api-version>' \
--data @- <<EOF
{
"rules": [
{
"expression": "http.request.ip in cidr('192.168.1.1/32')",
"action": "deny",
"deny_with": "Forbidden"
}
],
"environment": "ae_rrETjdWcfqI6AFsk",
"test_request_id": "req_abc123xyz",
"test_request_payload": {
"headers": {
"user-agent": [
"Mozilla/5.0"
],
"accept": [
"application/json"
]
},
"ip": "192.168.1.1",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
"sdkPlatform": "js",
"sdkVersion": "3.8.0",
"appPackageName": "com.example.app"
}
}
EOFimport requests
url = "https://management-api.fpjs.io/filtering-rules/test"
payload = {
"rules": [
{
"expression": "http.request.ip in cidr('192.168.1.1/32')",
"action": "deny",
"deny_with": "Forbidden"
}
],
"environment": "ae_rrETjdWcfqI6AFsk",
"test_request_id": "req_abc123xyz",
"test_request_payload": {
"headers": {
"user-agent": ["Mozilla/5.0"],
"accept": ["application/json"]
},
"ip": "192.168.1.1",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
"sdkPlatform": "js",
"sdkVersion": "3.8.0",
"appPackageName": "com.example.app"
}
}
headers = {
"X-API-Version": "<x-api-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-API-Version': '<x-api-version>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
rules: [
{
expression: 'http.request.ip in cidr(\'192.168.1.1/32\')',
action: 'deny',
deny_with: 'Forbidden'
}
],
environment: 'ae_rrETjdWcfqI6AFsk',
test_request_id: 'req_abc123xyz',
test_request_payload: {
headers: {'user-agent': ['Mozilla/5.0'], accept: ['application/json']},
ip: '192.168.1.1',
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
sdkPlatform: 'js',
sdkVersion: '3.8.0',
appPackageName: 'com.example.app'
}
})
};
fetch('https://management-api.fpjs.io/filtering-rules/test', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://management-api.fpjs.io/filtering-rules/test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'rules' => [
[
'expression' => 'http.request.ip in cidr(\'192.168.1.1/32\')',
'action' => 'deny',
'deny_with' => 'Forbidden'
]
],
'environment' => 'ae_rrETjdWcfqI6AFsk',
'test_request_id' => 'req_abc123xyz',
'test_request_payload' => [
'headers' => [
'user-agent' => [
'Mozilla/5.0'
],
'accept' => [
'application/json'
]
],
'ip' => '192.168.1.1',
'userAgent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
'sdkPlatform' => 'js',
'sdkVersion' => '3.8.0',
'appPackageName' => 'com.example.app'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-API-Version: <x-api-version>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://management-api.fpjs.io/filtering-rules/test"
payload := strings.NewReader("{\n \"rules\": [\n {\n \"expression\": \"http.request.ip in cidr('192.168.1.1/32')\",\n \"action\": \"deny\",\n \"deny_with\": \"Forbidden\"\n }\n ],\n \"environment\": \"ae_rrETjdWcfqI6AFsk\",\n \"test_request_id\": \"req_abc123xyz\",\n \"test_request_payload\": {\n \"headers\": {\n \"user-agent\": [\n \"Mozilla/5.0\"\n ],\n \"accept\": [\n \"application/json\"\n ]\n },\n \"ip\": \"192.168.1.1\",\n \"userAgent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36\",\n \"sdkPlatform\": \"js\",\n \"sdkVersion\": \"3.8.0\",\n \"appPackageName\": \"com.example.app\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Version", "<x-api-version>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://management-api.fpjs.io/filtering-rules/test")
.header("X-API-Version", "<x-api-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rules\": [\n {\n \"expression\": \"http.request.ip in cidr('192.168.1.1/32')\",\n \"action\": \"deny\",\n \"deny_with\": \"Forbidden\"\n }\n ],\n \"environment\": \"ae_rrETjdWcfqI6AFsk\",\n \"test_request_id\": \"req_abc123xyz\",\n \"test_request_payload\": {\n \"headers\": {\n \"user-agent\": [\n \"Mozilla/5.0\"\n ],\n \"accept\": [\n \"application/json\"\n ]\n },\n \"ip\": \"192.168.1.1\",\n \"userAgent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36\",\n \"sdkPlatform\": \"js\",\n \"sdkVersion\": \"3.8.0\",\n \"appPackageName\": \"com.example.app\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://management-api.fpjs.io/filtering-rules/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Version"] = '<x-api-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"rules\": [\n {\n \"expression\": \"http.request.ip in cidr('192.168.1.1/32')\",\n \"action\": \"deny\",\n \"deny_with\": \"Forbidden\"\n }\n ],\n \"environment\": \"ae_rrETjdWcfqI6AFsk\",\n \"test_request_id\": \"req_abc123xyz\",\n \"test_request_payload\": {\n \"headers\": {\n \"user-agent\": [\n \"Mozilla/5.0\"\n ],\n \"accept\": [\n \"application/json\"\n ]\n },\n \"ip\": \"192.168.1.1\",\n \"userAgent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36\",\n \"sdkPlatform\": \"js\",\n \"sdkVersion\": \"3.8.0\",\n \"appPackageName\": \"com.example.app\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"result": "deny",
"deny_with": "Forbidden",
"triggered_rule": "http.request.ip in cidr('192.168.1.1/32')"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"violations": [
{
"property": "<string>",
"message": "<string>"
}
]
}
}{
"error": {
"message": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"violations": [
{
"property": "<string>",
"message": "<string>"
}
]
}
}{
"error": {
"message": "<string>",
"code": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Management API version.
Body
Array of rules to test. If omitted, provide environment ID to test against existing rules.
Show child attributes
Show child attributes
Environment ID. Must be provided if rules are not
"ae_rrETjdWcfqI6AFsk"
Request ID to test against (up to 3 months old)
"req_abc123xyz"
Request data to test against
Show child attributes
Show child attributes
Response
Test results showing which rule was triggered (if any) and the resulting action.
Show child attributes
Show child attributes
Was this page helpful?