Ana içeriğe geç

Wallarm API İstek Örnekleri

Aşağıda Wallarm API'nin kullanımına dair bazı örnekler verilmiştir. Ayrıca US cloud veya EU cloud için API Reference UI aracılığıyla kod örnekleri oluşturabilirsiniz. Deneyimli kullanıcılar, Wallarm hesabınızın genel API'den veri almak için UI tarafından kullanılan API uç noktalarını ve isteklerini hızlıca öğrenmek amacıyla tarayıcılarının Developer console ("Network" sekmesi) özelliğini de kullanabilir. Developer console'un nasıl açılacağı hakkında bilgi almak için resmi tarayıcı dokümantasyonuna bakabilirsiniz (Safari, Chrome, Firefox, Vivaldi).

Son 24 Saatte Tespit Edilen İlk 50 Saldırıyı Alın

Lütfen TIMESTAMP değerini, 24 saat öncesine ait tarihin Unix Timestamp formatına dönüştürülmüş hali ile değiştirin.

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}"

Çok Sayıda Saldırıyı Alın (100 ve Üzeri)

100 veya daha fazla kayda sahip saldırı ve hit setleri için, büyük veri kümelerini tek seferde çekmek yerine, performansı optimize etmek amacıyla bunları parçalar halinde almak en iyisidir. İlgili Wallarm API uç noktaları, sayfa başına 100 kayıt olacak şekilde imleç tabanlı sayfalamayı destekler.

Bu teknik, veri kümesindeki belirli bir öğeye işaret eden bir gösterge döndürmeyi ve sonraki isteklerde sunucunun verilen gösterge sonrası sonuçları döndürmesini içerir. İmleçli sayfalamayı etkinleştirmek için istek parametrelerine "paging": true ekleyin.

Aşağıda, imleçli sayfalama kullanılarak <TIMESTAMP>'den itibaren tespit edilen tüm saldırıların alınması için API çağrısı örnekleri verilmiştir:

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"}}'

Bu istek, en yeni 100 saldırı hakkında bilgiyi, en güncelden en eskisine doğru sıralı şekilde döndürür. Ek olarak, yanıt içerisinde bir sonraki 100 saldırı setine işaret eden cursor parametresi de yer alır.

Bir sonraki 100 saldırıyı almak için, önceki istek ile aynı isteği kullanın fakat önceki yanıttan kopyalanan işaretçi değeriyle birlikte cursor parametresini ekleyin. Bu, API'nın bir sonraki 100 saldırı setinin nereden başlaması gerektiğini anlamasını sağlar, örneğin:

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"}}'

Sonraki sonuç sayfalarını almak için, önceki yanıttan kopyalanan değere sahip cursor parametresini içeren istekleri gönderin.

Aşağıda, imleçli sayfalama kullanarak saldırıları almak için Python kod örneği verilmiştir:

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>",
    "X-WallarmAPI-Secret": "<YOUR_SECRET_KEY>",
    "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

Son 24 Saatte Onaylanan İlk 50 İnsidenti Alın

Bu istek, saldırı listesindeki önceki örneğe çok benzer; bu isteğe "!vulnid": null terimi eklenmiştir. Bu terim, API'ya belirtilmemiş vulnerability ID'sine sahip tüm saldırıları göz ardı etmesini söyler ve sistemin saldırılar ile incident'lar arasında ayrım yapmasını sağlar.

Lütfen TIMESTAMP değerini, 24 saat öncesine ait tarihin Unix Timestamp formatına dönüştürülmüş hali ile değiştirin.

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}"

Son 24 Saat İçinde "active" Durumundaki İlk 50 Güvenlik Açığını Alın

Lütfen TIMESTAMP değerini, 24 saat öncesine ait tarihin Unix Timestamp formatına dönüştürülmüş hali ile değiştirin.

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]]}}"

Tüm Yapılandırılmış Kuralları Alın

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}"

Tüm Kuralların Sadece Şartlarını Alın

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}"

Belirli Bir Şarta Bağlı Kuralları Alın

Belirli bir şartı işaret etmek için, onun ID'sini kullanın - tüm kuralların şartlarını sorguladığınızda (yukarıya bakın) bunu edinebilirsiniz.

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/*'ye Gönderilen Tüm İstekleri Engellemek İçin Sanal Yama Oluşturun

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/*'ye Gönderilen Tüm İstekleri Engellemek İçin Belirli Bir Uygulama Örneği ID'sine Sahip Sanal Yama Oluşturun

Bu isteği göndermeden önce bir uygulama yapılandırılmış olmalıdır. action.point[instance].value alanına mevcut bir uygulamanın ID'sini belirtin.

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 Başlığının Belirli Bir Değerine Sahip İstekleri Saldırı Olarak Değerlendirmek İçin Kural Oluşturun

Aşağıdaki istek, regexp tabanlı özel saldırı göstergesini ^(~(44[.]33[.]22[.]11))$ oluşturacaktır.

Eğer MY.DOMAIN.COM alan adına yapılan istekler X-FORWARDED-FOR: 44.33.22.11 HTTP başlığına sahip ise, Wallarm node'u bunları tarayıcı saldırısı olarak değerlendirir ve ilgili filtration mode ayarlanmışsa saldırıları engeller.

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\)\)$\"}"

Belirli Uygulama İçin Monitoring Modunda Filtrasyon Modunu Ayarlayan Kuralı Oluşturun

Aşağıdaki istek, monitoring modunda olan, uygulamaya giden trafiği filtrelemesi için düğümü ayarlayan kuralı oluşturacaktır. İlgili uygulamanın ID'si 3 olarak belirtilmiştir.

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"}]}'

Kuralı ID'sine Göre Silin

Silinmek üzere kuralın ID'sini, tüm yapılandırılmış kuralları alırken kopyalayabilirsiniz. Ayrıca, kural oluşturma isteğine verilen yanıtta id response parametresi aracılığıyla da kural ID'si döndürülür.

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}}"

IP Listesi Nesnelerini Almak, Doldurmak ve Silmek İçin API Çağrıları

Aşağıda, IP listesi nesnelerini almak, doldurmak ve silmek için bazı API çağrısı örnekleri verilmiştir.

API İstek Parametreleri

IP listelerini okumak ve değiştirmek için API isteklerine geçirilecek parametreler:

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 Dosyasındaki Girdileri Listeye Ekleyin

.csv dosyasındaki IP'ler veya alt ağları listeye eklemek için aşağıdaki bash betiğini kullanın:

#!/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

Listeye Tek Bir IP veya Alt Ağ Ekleyin

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>"}}'

Listeye Birden Fazla Ülke Ekleyin

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}'

Listeye Birden Fazla Proxy Servis Ekleyin

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 Listesinden Bir Nesneyi Silin

Nesneler, IP listelerden ID'leriyle silinir.

Bir nesnenin ID'sini elde etmek için, IP liste içeriğini sorgulayın ve istenen nesnenin objects.id değerini yanıt içerisinden kopyalayın:

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>'

Nesne ID'sine sahip olduktan sonra, liste içerisinden silmek için aşağıdaki isteği gönderin:

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>]}}'

Silme isteğinde ID'lerini bir dizi olarak geçirerek aynı anda birden fazla nesneyi silebilirsiniz.