انتقل إلى المحتوى

أمثلة على طلب API من Wallarm

فيما يلي بعض أمثلة استخدام API من Wallarm. يمكنك أيضًا إنشاء أمثلة الرموز عبر واجهة المستخدم للإشارة إلى API لـ السحابة الأمريكية أو السحابة الأوروبية. يمكن للمستخدمين ذوي الخبرة أيضًا استخدام واجهة برمجة الطبيقات المطورة للمتصفح ("علامة التبويب الشبكة") لتعلم بسرعة أي نقاط الطرف والطلبات المستخدمة من واجهة المستخدم لحسابك في Wallarm لجمع البيانات من API العامة. يمكنك البحث عن معلومات حول كيفية فتح وحدة تحكم المطور باستخدام التوثيق الرسمي للمتصفح (Safari, Chrome, Firefox, Vivaldi).

احصل على الهجمات الـ50 الأولى التي تم اكتشافها في الـ 24 ساعة الماضية

يرجى استبدال TIMESTAMP بالتاريخ منذ 24 ساعة وتحويله إلى تنسيق Unix Timestamp.

curl -v -X POST "https://us1.api.wallarm.com/v1/objects/attack" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json"  -H "Content-Type: application/json" -d "{ \"filter\": { \"clientid\": [YOUR_CLIENT_ID], \"time\": [[TIMESTAMP, null]] }, \"offset\": 0, \"limit\": 50, \"order_by\": \"last_time\", \"order_desc\": true}"
curl -v -X POST "https://api.wallarm.com/v1/objects/attack" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"filter\": { \"clientid\": [YOUR_CLIENT_ID], \"time\": [[TIMESTAMP, null]] }, \"offset\": 0, \"limit\": 50, \"order_by\": \"last_time\", \"order_desc\": true}"

الحصول على عدد كبير من الهجمات (100 وأكثر)

بالنسبة لمجموعات الهجمات والضربات التي تحتوي على 100 سجل أو أكثر ، من الأفضل استردادها بأجزاء أصغر بدلاً من جمع مجموعات البيانات الكبيرة في آن واحد، وذلك من أجل تحسين الأداء. وتدعم نقاط API العليا لـ Wallarm الصفحة بناءً على المؤشر مع 100 سجل لكل صفحة.

تتضمن هذه التقنية إعادة المؤشر إلى عنصر محدد في مجموعة البيانات ثم في الطلبات التالية ، يعيد الخادم النتائج بعد المؤشر المعطى. لتمكين ترتيب الصفحة بواسطة المؤشر، تضمين "paging": true في معلمات الطلب.

فيما يلي أمثلة لاستدعاءات API لاسترداد جميع الهجمات التي تم اكتشافها منذ <TIMESTAMP> باستخدام ترتيب الصفحة بواسطة المؤشر:

curl -k 'https://api.wallarm.com/v2/objects/attack' \
  -X POST \
  -H 'X-WallarmApi-Token: <YOUR_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{"paging": true, "filter": {"clientid": [<YOUR_CLIENT_ID>], "vulnid": null, "time": [[<TIMESTAMP>, null]], "!state": "falsepositive"}}'
curl -k 'https://us1.api.wallarm.com/v2/objects/attack' \
  -X POST \
  -H 'X-WallarmApi-Token: <YOUR_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{"paging": true, "filter": {"clientid": [<YOUR_CLIENT_ID>], "vulnid": null, "time": [[<TIMESTAMP>, null]], "!state": "falsepositive"}}'

يعود هذا الطلب بمعلومات حول الهجمات الـ100 الأخيرة المكتشفة، مرتبة من الأحدث إلى الأقدم. بالإضافة إلى ذلك، يتضمن الرد معلمة cursor التي تحتوي على مؤشر إلى المجموعة التالية من 100 هجوم.

لاسترداد الـ100 هجوم التالية، استخدم نفس الطلب مثل السابق ولكن قم بتضمين معلمة cursor مع قيمة المؤشر نسخ من رد الطلب السابق. يتيح هذا لواجهة برمجة التطبيقات معرفة أين تبدأ في إرجاع المجموعة التالية من 100 هجوم من ، على سبيل المثال:

curl -k 'https://api.wallarm.com/v2/objects/attack' \
  -X POST \
  -H 'X-WallarmApi-Token: <YOUR_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{"cursor":"<POINTER_FROM_PREVIOUS_RESPONSE>", "paging": true, "filter": {"clientid": [<YOUR_CLIENT_ID>], "vulnid": null, "time": [[<TIMESTAMP>, null]], "!state": "falsepositive"}}'
curl -k 'https://us1.api.wallarm.com/v2/objects/attack' \
  -X POST \
  -H 'X-WallarmApi-Token: <YOUR_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{"cursor":"<POINTER_FROM_PREVIOUS_RESPONSE>", "paging": true, "filter": {"clientid": [<YOUR_CLIENT_ID>], "vulnid": null, "time": [[<TIMESTAMP>, null]], "!state": "falsepositive"}}'

لاسترداد صفحات النتائج الأخرى، تنفيذ طلبات تضمن معلمة cursor مع القيمة نسخ من الرد السابق.

أدناه هو مثال لرمز Python لاسترداد الهجمات باستخدام ترتيب الصفحة بواسطة المؤشر:

import json
from pprint import pprint as pp

import requests


client_id = <YOUR_CLIENT_ID>
ts = <TIMESTAMP>  # UNIX time

url = "https://api.wallarm.com/v2/objects/attack"
headers = {
    "X-WallarmApi-Token": "<YOUR_TOKEN>",
    "Content-Type": "application/json",
}
payload = {
    "paging": True,
    "filter": {
        "clientid": [client_id],
        "vulnid": None,
        "time": [[ts, None]],
        "!state": "falsepositive",
    },
}


while True:
    response = requests.post(url, headers=headers, json=payload)
    data = response.json()

    cursor = data.get("cursor")
    if not cursor:
        break

    pp(data)
    payload["cursor"] = cursor
import json
from pprint import pprint as pp

import requests


client_id = <YOUR_CLIENT_ID>
ts = <TIMESTAMP>  # UNIX time

url = "https://us1.api.wallarm.com/v2/objects/attack"
headers = {
    "X-WallarmApi-Token": "<YOUR_TOKEN>",
    "Content-Type": "application/json",
}
payload = {
    "paging": True,
    "filter": {
        "clientid": [client_id],
        "vulnid": None,
        "time": [[ts, None]],
        "!state": "falsepositive",
    },
}


while True:
    response = requests.post(url, headers=headers, json=payload)
    data = response.json()

    cursor = data.get("cursor")
    if not cursor:
        break

    pp(data)
    payload["cursor"] = cursor

الحصول على الحوادث الـ50 الأولى المؤكدة في الـ 24 ساعة الماضية

الطلب مشابه جدًا للمثال السابق لقائمة الهجمات؛ يتم إضافة الحالة "!vulnid": null إلى هذا الطلب. توجه هذه الحالة للـ API لتجاهل جميع الهجمات التي لا تحتوي على معرف الثغرات الأمنية المحدد، وهكذا تميز النظام بين الهجمات والحوادث.

يرجى استبدال TIMESTAMP بالتاريخ منذ 24 ساعة وتحويله إلى تنسيق Unix Timestamp.

curl -v -X POST "https://us1.api.wallarm.com/v1/objects/attack" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json"  -H "Content-Type: application/json" -d "{ \"filter\": { \"clientid\": [YOUR_CLIENT_ID], \"\!vulnid\": null, \"time\": [[TIMESTAMP, null]] }, \"offset\": 0, \"limit\": 50, \"order_by\": \"last_time\", \"order_desc\": true}"
curl -v -X POST "https://api.wallarm.com/v1/objects/attack" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"filter\": { \"clientid\": [YOUR_CLIENT_ID], \"\!vulnid\": null, \"time\": [[TIMESTAMP, null]] }, \"offset\": 0, \"limit\": 50, \"order_by\": \"last_time\", \"order_desc\": true}"

الحصول على الثغرات الأمنية الـ50 الأولى في الوضع "نشط" خلال الـ24 ساعة الماضية

يرجى استبدال TIMESTAMP بالتاريخ منذ 24 ساعة وتحويله إلى تنسيق Unix Timestamp.

curl -v -X POST "https://us1.api.wallarm.com/v1/objects/vuln" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"limit\":50, \"offset\":0, \"filter\":{\"clientid\":[YOUR_CLIENT_ID], \"testrun_id\":null, \"validated\":true, \"time\":[[TIMESTAMP, null]]}}"
curl -v -X POST "https://api.wallarm.com/v1/objects/vuln" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"limit\":50, \"offset\":0, \"filter\":{\"clientid\":[YOUR_CLIENT_ID], \"testrun_id\":null, \"validated\":true, \"time\":[[TIMESTAMP, null]]}}"

الحصول على جميع القواعد المكونة

curl -v -X POST "https://us1.api.wallarm.com/v1/objects/hint" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"filter\":{\"clientid\": [YOUR_CLIENT_ID]},\"order_by\": \"updated_at\",\"order_desc\": true,\"limit\": 1000,\"offset\": 0}"
curl -v -X POST "https://api.wallarm.com/v1/objects/hint" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"filter\":{\"clientid\": [YOUR_CLIENT_ID]},\"order_by\": \"updated_at\",\"order_desc\": true,\"limit\": 1000,\"offset\": 0}"

الحصول على الشروط فقط لجميع القواعد

curl -v -X POST "https://us1.api.wallarm.com/v1/objects/action" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"filter\": { \"clientid\": [YOUR_CLIENT_ID] }, \"offset\": 0, \"limit\": 1000}"
curl -v -X POST "https://api.wallarm.com/v1/objects/action" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"filter\": { \"clientid\": [YOUR_CLIENT_ID] }, \"offset\": 0, \"limit\": 1000}"

الحصول على القواعد المرتبطة بشرط محدد

للإشارة إلى شرط معين ، استخدم معرفه - يمكنك الحصول عليه عند طلب شروط جميع القواعد (انظر أعلاه).

curl -v -X POST "https://us1.api.wallarm.com/v1/objects/hint" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"filter\":{\"clientid\": [YOUR_CLIENT_ID],\"actionid\": YOUR_CONDITION_ID},\"limit\": 1000,\"offset\": 0}"
curl -v -X POST "https://api.wallarm.com/v1/objects/hint" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"filter\":{\"clientid\": [YOUR_CLIENT_ID],\"actionid\": YOUR_CONDITION_ID},\"limit\": 1000,\"offset\": 0}"

قم بإنشاء التصحيح الافتراضي لمنع كل الطلبات المرسلة إلى /my/api/*

curl -v -X POST "https://us1.api.wallarm.com/v1/objects/hint/create" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"clientid\": YOUR_CLIENT_ID, \"type\": \"vpatch\", \"action\": [ {\"type\":\"equal\",\"value\":\"my\",\"point\":[\"path\",0]}, {\"type\":\"equal\",\"value\":\"api\",\"point\":[\"path\",1]}], \"validated\": false, \"point\": [ [ \"header\", \"HOST\" ] ], \"attack_type\": \"any\"}"
curl -v -X POST "https://api.wallarm.com/v1/objects/hint/create" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"clientid\": YOUR_CLIENT_ID, \"type\": \"vpatch\", \"action\": [ {\"type\":\"equal\",\"value\":\"my\",\"point\":[\"path\",0]}, {\"type\":\"equal\",\"value\":\"api\",\"point\":[\"path\",1]}], \"validated\": false, \"point\": [ [ \"header\", \"HOST\" ] ], \"attack_type\": \"any\"}"

إنشاء التصحيح الافتراضي لمعرف نموذج التطبيق المحدد لمنع كل الطلبات المرسلة إلى /my/api/*

يجب أن يكون التطبيق مكوناً قبل إرسال هذا الطلب. حدد معرف التطبيق الموجود في action.point[instance].value.

curl -v -X POST "https://us1.api.wallarm.com/v1/objects/hint/create" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"type\":\"vpatch\",\"action\":[{\"point\":[\"instance\"],\"type\":\"equal\",\"value\":\"-1\"},{\"point\":[\"path\",0],\"type\":\"equal\",\"value\":\"my\"},{\"point\":[\"path\",1],\"type\":\"equal\",\"value\":\"api\"}],\"clientid\":YOUR_CLIENT_ID,\"validated\":false,\"point\":[[\"header\",\"HOST\"]],\"attack_type\":\"any\"}"
curl -v -X POST "https://api.wallarm.com/v1/objects/hint/create" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"type\":\"vpatch\",\"action\":[{\"point\":[\"instance\"],\"type\":\"equal\",\"value\":\"-1\"},{\"point\":[\"path\",0],\"type\":\"equal\",\"value\":\"my\"},{\"point\":[\"path\",1],\"type\":\"equal\",\"value\":\"api\"}],\"clientid\":YOUR_CLIENT_ID,\"validated\":false,\"point\":[[\"header\",\"HOST\"]],\"attack_type\":\"any\"}"

أنشئ قاعدة للحساب بك أن الطلبات ذات القيمة المحددة للرأس X-FORWARDED-FOR هي هجمات

سيقوم الطلب التالي بإنشاء مؤشر هجوم مخصص استنادًا إلى regexp ^(~(44[.]33[.]22[.]11))$.

إذا كانت الطلبات إلى النطاق MY.DOMAIN.COM لديها رأس HTTP X-FORWARDED-FOR: 44.33.22.11, ستعتبر عقدة Wallarmهم كهجمات من الاسكانير وسوف تمنع الهجمات إذا تم تعيين الوضع الفلترة المقابل filtration mode.

curl -v -X POST "https://us1.api.wallarm.com/v1/objects/hint/create" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"type\":\"regex\",\"action\":[{\"point\":[\"header\",\"HOST\"],\"type\":\"equal\",\"value\":\"MY.DOMAIN.NAME\"}],\"clientid\":YOUR_CLIENT_ID,\"validated\":false,\"comment\":\"comment\",\"point\":[[\"header\",\"X-FORWARDED-FOR\"]],\"attack_type\":\"scanner\",\"regex\":\"^\(~\(44[.]33[.]22[.]11\)\)$\"}"
curl -v -X POST "https://api.wallarm.com/v1/objects/hint/create" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"type\":\"regex\",\"action\":[{\"point\":[\"header\",\"HOST\"],\"type\":\"equal\",\"value\":\"MY.DOMAIN.NAME\"}],\"clientid\":YOUR_CLIENT_ID,\"validated\":false,\"comment\":\"comment\",\"point\":[[\"header\",\"X-FORWARDED-FOR\"]],\"attack_type\":\"scanner\",\"regex\":\"^\(~\(44[.]33[.]22[.]11\)\)$\"}"

أنشئ القاعدة التي تضبط وضع الفلترة على المراقبة للتطبيق المحدد

سيقوم الطلب التالي بإنشاء القاعدة التي تضبط العقدة لتصفية الحركة المتجهة إلى التطبيق مع معرف 3 بوضع المراقبة.

curl 'https://us1.api.wallarm.com/v1/objects/hint/create' -H 'X-WallarmApi-Token: <YOUR_TOKEN>' -H "accept: application/json" -H "Content-Type: application/json" --data-raw '{"clientid":<YOUR_CLIENT_ID>,"type":"wallarm_mode","mode":"monitoring","validated":false,"action":[{"point":["instance"],"type":"equal","value":"3"}]}'
curl 'https://api.wallarm.com/v1/objects/hint/create' -H 'X-WallarmApi-Token: <YOUR_TOKEN>' -H "accept: application/json" -H "Content-Type: application/json" --data-raw '{"clientid":<YOUR_CLIENT_ID>,"type":"wallarm_mode","mode":"monitoring","validated":false,"action":[{"point":["instance"],"type":"equal","value":"3"}]}'

حذف القاعدة بمعرفها

يمكنك نسخ معرف القاعدة ليتم حذفه عند الحصول على جميع القواعد المكونة. كما تم إرجاع معرف القاعدة في استجابة لطلب إنشاء القاعدة ، في معلمة الاستجابة id.

curl -v -X POST "https://us1.api.wallarm.com/v1/objects/hint/delete" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"filter\":{\"clientid\":[YOUR_CLIENT_ID],\"id\": YOUR_RULE_ID}}"
curl -v -X POST "https://api.wallarm.com/v1/objects/hint/delete" -H "X-WallarmApi-Token: <YOUR_TOKEN>" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"filter\":{\"clientid\":[YOUR_CLIENT_ID],\"id\": YOUR_RULE_ID}}"

استدعاءات API للحصول على، وتعبئة وحذف كائنات قائمة الـ IP

أدناه بعض الأمثلة على استدعاءات API للحصول على، وتعبئة وحذف كائنات قائمة الـ IP.

معلمات طلب API

المعلمات التي يجب تمريرها في طلبات API لقراءة وتغيير قوائم الـ IP:

Parameter Description
X-WallarmApi-Token Token to access Wallarm API, copy it from Wallarm Console → SettingsAPI tokens.
clientid ID of an account in Wallarm Cloud to populate/read IP list.
ip_rule.list The IP list type to add objects, can be: black (for denylist), white (for allowlist), gray (for graylist).
ip_rule.rule_type The type of objects to add to the list:
  • ip_range if adding particular IPs or subnets
  • country if adding countries or regions
  • proxy_type if adding proxy services (VPN, SES, PUB, WEB, TOR)
  • datacenter for other source types (rackspace, tencent, plusserver, ovh, oracle, linode, ibm, huawei, hetzner, gce, azure, aws, alibaba)
ip_rule.subnet
(rule_type:"ip_range")
IP or subnet to add to the list, e.g. "1.1.1.1".
ip_rule.source_values
(for other rule_type values)
One of the options:
  • If rule_type:"country" - array of countries in the ISO-3166 format, e.g. ["AX","AL"].
  • If rule_type:"proxy_type" - array of proxy services, e.g. ["VPN","PUB"].
  • If rule_type:"datacenter" - array of other source types, e.g. ["rackspace","huawei"].
ip_rule.pools Array of application IDs to allow or restrict access for IPs, e.g. [3,4] for applications IDs 3 and 4 or [0] for all applications.
ip_rule.expired_at Unix Timestamp date for IPs to be removed from the list. The maximum value is forever (33223139044).
reason Reason to allow or restrict access for IPs.
force If true and some objects specified in the request are already in the IP list, the script will overwrite them.

إضافة إلى القائمة الإدخالات من ملف .csv

لإضافة IPs أو الشبكات الفرعية من ملف .csv إلى القائمة، استعمل النص البرمجي bash التالي:

#!/bin/bash

UUID="<YOUR_UUID>"
SECRET="<YOUR_SECRET_KEY>"
CLIENT="<YOUR_CLIENT_ID>"
LIST="<TYPE_OF_IP_LIST>"
PATH_TO_CSV_FILE="<PATH_TO_CSV_FILE>" # path to the CSV file with IPs or subnets
APPLICATIONS="<APP_IDS_THROUGH_COMMA>"
REMOVE_DATE="TIMESTAMP_REMOVE_DATE"
REASON='<REASON>'
API="us1.api.wallarm.com"


index=0
while read line; do
    subnets[$index]="$line"
    index=$(($index+1))
done < "$PATH_TO_CSV_FILE"


for i in ${subnets[@]}; do
    currentDate=`date -u +%s`
    time=$REMOVE_DATE
    remove_date=$(($currentDate+$time))

curl -X POST \
https://$API/v4/ip_rules \
-H "Content-Type: application/json" \
-H "X-WallarmApi-Token: <YOUR_TOKEN>"  \
-d '{
"clientid": '$CLIENT',
"ip_rule": {
    "list": "'$LIST'",
    "rule_type": "ip_range",
    "subnet": "'$i'",
    "expired_at": '$remove_date',
    "pools": [
        '$APPLICATIONS'
    ],
    "reason": "'"$REASON"'"
},
"force": false
}'

done
#!/bin/bash

UUID="<YOUR_UUID>"
SECRET="<YOUR_SECRET_KEY>"
CLIENT="<YOUR_CLIENT_ID>"
LIST="<TYPE_OF_IP_LIST>"
PATH_TO_CSV_FILE="<PATH_TO_CSV_FILE>" # path to the CSV file with IPs or subnets
APPLICATIONS="<APP_IDS_THROUGH_COMMA>"
REMOVE_DATE="TIMESTAMP_REMOVE_DATE"
REASON='<REASON>'
API="api.wallarm.com"


index=0
while read line; do
    subnets[$index]="$line"
    index=$(($index+1))
done < "$PATH_TO_CSV_FILE"


for i in ${subnets[@]}; do
    currentDate=`date -u +%s`
    time=$REMOVE_DATE
    remove_date=$(($currentDate+$time))

curl -X POST \
https://$API/v4/ip_rules \
-H "Content-Type: application/json" \
-H "X-WallarmApi-Token: <YOUR_TOKEN>"  \
-d '{
"clientid": '$CLIENT',
"ip_rule": {
    "list": "'$LIST'",
    "rule_type": "ip_range",
    "subnet": "'$i'",
    "expired_at": '$remove_date',
    "pools": [
        '$APPLICATIONS'
    ],
    "reason": "'"$REASON"'"
},
"force": false
}'

done

إضافة إلى القائمة IP واحدة أو شبكة فرعية

To add particular IPs or subnets to the IP list, send the following request for each IP/subnet:

curl 'https://us1.api.wallarm.com/v4/ip_rules' \
  -H 'X-WallarmApi-Token: <YOUR_TOKEN>' \
  -H "accept: application/json" \
  -H "Content-Type: application/json" \
  --data-raw '{"clientid":<YOUR_CLIENT_ID>,"force":false,"ip_rule":{"list":"<TYPE_OF_IP_LIST>","reason":"<REASON_TO_ADD_ENTRIES_TO_LIST>","pools":[<ARRAY_OF_APP_IDS>],"expired_at":<TIMESTAMP_REMOVE_DATE>,"rule_type":"ip_range","subnet":"<IP_OR_SUBNET>"}}'
curl 'https://api.wallarm.com/v4/ip_rules' \
  -H 'X-WallarmApi-Token: <YOUR_TOKEN>' \
  -H "accept: application/json" \
  -H "Content-Type: application/json" \
  --data-raw '{"clientid":<YOUR_CLIENT_ID>,"force":false,"ip_rule":{"list":"<TYPE_OF_IP_LIST>","reason":"<REASON_TO_ADD_ENTRIES_TO_LIST>","pools":[<ARRAY_OF_APP_IDS>],"expired_at":<TIMESTAMP_REMOVE_DATE>,"rule_type":"ip_range","subnet":"<IP_OR_SUBNET>"}}'

إضافة إلى القائمة العديد من الدول

curl 'https://us1.api.wallarm.com/v4/ip_rules' \
  -H 'X-WallarmApi-Token: <YOUR_TOKEN>' \
  -H "accept: application/json" \
  -H "Content-Type: application/json" \
  --data-raw '{"clientid":<YOUR_CLIENT_ID>,"ip_rule":{"list":"<TYPE_OF_IP_LIST>","rule_type":"country","source_values":[<ARRAY_OF_COUNTRIES_REGIONS>],"pools":[<ARRAY_OF_APP_IDS>],"expired_at":"<TIMESTAMP_REMOVE_DATE>","reason":"<REASON_TO_ADD_ENTRIES_TO_LIST>"},"force":false}'
curl 'https://api.wallarm.com/v4/ip_rules' \
  -H 'X-WallarmApi-Token: <YOUR_TOKEN>' \
  -H "accept: application/json" \
  -H "Content-Type: application/json" \
  --data-raw '{"clientid":<YOUR_CLIENT_ID>,"ip_rule":{"list":"<TYPE_OF_IP_LIST>","rule_type":"country","source_values":[<ARRAY_OF_COUNTRIES_REGIONS>],"pools":[<ARRAY_OF_APP_IDS>],"expired_at":"<TIMESTAMP_REMOVE_DATE>","reason":"<REASON_TO_ADD_ENTRIES_TO_LIST>"},"force":false}'

إضافة إلى القائمة العديد من خدمات البروكسي

curl 'https://us1.api.wallarm.com/v4/ip_rules' \
  -H 'X-WallarmApi-Token: <YOUR_TOKEN>' \
  -H "accept: application/json" \
  -H "Content-Type: application/json" \
  --data-raw '{"clientid":<YOUR_CLIENT_ID>,"ip_rule":{"list":"<TYPE_OF_IP_LIST>","rule_type":"proxy_type","source_values":[<ARRAY_OF_PROXY_SERVICES>],"pools":[<ARRAY_OF_APP_IDS>],"expired_at":"<TIMESTAMP_REMOVE_DATE>","reason":"<REASON_TO_ADD_ENTRIES_TO_LIST>"},"force":false}'
curl 'https://api.wallarm.com/v4/ip_rules' \
  -H 'X-WallarmApi-Token: <YOUR_TOKEN>' \
  -H "accept: application/json" \
  -H "Content-Type: application/json" \
  --data-raw '{"clientid":<YOUR_CLIENT_ID>,"ip_rule":{"list":"<TYPE_OF_IP_LIST>","rule_type":"proxy_type","source_values":[<ARRAY_OF_PROXY_SERVICES>],"pools":[<ARRAY_OF_APP_IDS>],"expired_at":"<TIMESTAMP_REMOVE_DATE>","reason":"<REASON_TO_ADD_ENTRIES_TO_LIST>"},"force":false}'

حذف كائن من قائمة الـ IP

يتم حذف الكائنات من قوائم الـ IP بواسطة معرفاتهم.

للحصول على معرف الكائن، اطلب محتويات قائمة الـ IP وانسخ objects.id من الكائن المطلوب من الاستجابة:

curl 'https://us1.api.wallarm.com/v4/ip_rules?filter%5Bclientid%5D=<YOUR_CLIENT_ID>&filter%5Blist%5D=<TYPE_OF_IP_LIST>&offset=0&limit=50' \
      -H 'X-WallarmApi-Token: <YOUR_TOKEN>'
curl 'https://api.wallarm.com/v4/ip_rules?filter%5Bclientid%5D=<YOUR_CLIENT_ID>&filter%5Blist%5D=<TYPE_OF_IP_LIST>&offset=0&limit=50' \
      -H 'X-WallarmApi-Token: <YOUR_TOKEN>'

عندما يكون لديك معرف الكائن، أرسل الطلب التالي لحذف الكائن من القائمة:

curl 'https://us1.api.wallarm.com/v4/ip_rules' \
  -X 'DELETE' \
  -H 'X-WallarmApi-Token: <YOUR_TOKEN>' \
  -H 'accept: application/json' \
  -H 'content-type: application/json' \
  --data-raw '{"filter":{"clientid":<YOUR_CLIENT_ID>,"id":[<OBJECT_ID_TO_DELETE>]}}'
curl 'https://api.wallarm.com/v4/ip_rules' \
  -X 'DELETE' \
  -H 'X-WallarmApi-Token: <YOUR_TOKEN>' \
  -H 'accept: application/json' \
  -H 'content-type: application/json' \
  --data-raw '{"filter":{"clientid":<YOUR_CLIENT_ID>,"id":[<OBJECT_ID_TO_DELETE>]}}'

يمكنك حذف أكثر من كائن في وقت واحد عن طريق تمرير معرفاتهم كمصفوفة في طلب الحذف.