Pular para conteúdo

Exemplos de solicitação de API da Wallarm

A seguir estão alguns exemplos do uso da API da Wallarm. Você também pode gerar exemplos de código por meio da interface de referência da API para a nuvem nos EUA ou nuvem na UE. Usuários experientes também podem usar o console do desenvolvedor do navegador ("Network" tab) para aprender rapidamente quais terminais e solicitações da API são usados ​​pela interface do usuário da sua conta Wallarm para buscar dados da API pública. Para obter informações sobre como abrir o console do desenvolvedor, você pode usar a documentação oficial do navegador (Safari, Chrome, Firefox, Vivaldi).

Obter os primeiros 50 ataques detectados nas últimas 24 horas

Substitua TIMESTAMP pela data de 24 horas atrás convertida para o formato 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}"

Obter grandes quantidades de ataques (100 ou mais)

Para conjuntos de ataques e hits contendo 100 ou mais registros, o ideal é recuperá-los em partes menores, em vez de buscar grandes conjuntos de dados de uma só vez, para otimizar o desempenho. Os terminais correspondentes da API Wallarm suportam paginação baseada em cursor com 100 registros por página.

Essa técnica envolve retorno de um ponteiro para um item específico no conjunto de dados e, em seguida, em solicitações subsequentes, o servidor retorna resultados após o ponteiro fornecido. Para habilitar a paginação do cursor, inclua "paging": true nos parâmetros de solicitação.

Os seguintes são exemplos de chamadas de API para recuperar todos os ataques detectados desde <TIMESTAMP> usando a paginação do cursor:

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

Esta solicitação retorna informações sobre os últimos 100 ataques detectados, organizados do mais recente para o mais antigo. Além disso, a resposta inclui um parâmetro cursor que contém um ponteiro para o próximo conjunto de 100 ataques.

Para recuperar os próximos 100 ataques, use a mesma solicitação de antes, mas inclua o parâmetro cursor com o valor do ponteiro copiado da resposta da solicitação anterior. Isso permite que a API saiba de onde começar a retornar o próximo conjunto de 100 ataques, por exemplo:

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

Para recuperar mais páginas de resultados, execute solicitações incluindo o parâmetro cursor com o valor copiado da resposta anterior.

Abaixo está o exemplo de código Python para recuperar ataques usando a paginação do cursor:

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

Obter os primeiros 50 incidentes confirmados nas últimas 24 horas

A solicitação é muito semelhante ao exemplo anterior para uma lista de ataques; o termo "!vulnid": null é adicionado a esta solicitação. Este termo instrui a API para ignorar todos os ataques sem ID de vulnerabilidade especificado, e é assim que o sistema distingue entre ataques e incidentes.

Substitua TIMESTAMP pela data de 24 horas atrás convertida para o formato Unix Timestamp.

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

Obter as primeiras 50 vulnerabilidades no status "active" nas últimas 24 horas

Substitua TIMESTAMP pela data de 24 horas atrás convertida para o formato 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]]}}"

Obter todas as regras configuradas

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

Obter apenas as condições de todas as regras

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

Obter regras anexadas a uma condição específica

Para apontar para uma condição específica, use seu ID - você pode obtê-lo ao solicitar condições de todas as regras (veja acima).

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

Criar o patch virtual para bloquear todas as solicitações enviadas para /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\"}"

Criar o patch virtual para um ID de instância de aplicativo específico para bloquear todas as solicitações enviadas para /my/api/*

Um aplicativo deve ser configurado antes de enviar esta solicitação. Especifique um ID de um aplicativo existente em 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\"}"

Criar uma regra para considerar as solicitações com um valor específico do cabeçalho X-FORWARDED-FOR como ataques

A seguinte solicitação criará o indicador de ataque personalizado com base na expressão regular ^(~(44[.]33[.]22[.]11))$.

Se as solicitações para o domínio MY.DOMAIN.COM tiverem o cabeçalho HTTP X-FORWARDED-FOR: 44.33.22.11, o nó Wallarm as considerará como ataques de scanner e bloqueará os ataques se o modo de filtragem correspondente tiver sido definido.

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

Criar a regra definindo o modo de filtragem para monitoramento para o aplicativo específico

A seguinte solicitação criará a regra que define o nó para filtrar o tráfego que vai para o aplicativo com ID 3 no modo de monitoramento.

curl 'https://us1.api.wallarm.com/v1/objects/hint/create' -H 'X-WallarmApi-Token: <YOUR_TOKEN>' -H "aceita: application/json" -H "Tipo de conteúdo: 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 "aceita: application/json" -H "Tipo de conteúdo: application/json" --data-raw '{"clientid":<YOUR_CLIENT_ID>,"type":"wallarm_mode","mode":"monitoring","validated":false,"action":[{"point":["instance"],"type":"equal","value":"3"}]}'

Excluir regra por seu ID

Você pode copiar o ID da regra a ser excluída ao obter todas as regras configuradas. Além disso, um ID de regra foi retornado em resposta à solicitação de criação de regra, no parâmetro de resposta 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}}"

Chamadas de API para obter, preencher e excluir objetos da lista de IPs

A seguir estão alguns exemplos de chamadas de API para obter, preencher e excluir objetos da lista de IPs.

Parâmetros de solicitação de API

Parâmetros a serem passados ​​nas solicitações de API para ler e alterar listas de IPs:

Parâmetro Descrição
X-WallarmApi-Token Token para acessar API Wallarm, copie-o do Wallarm Console → ConfiguraçõesTokens de API.
clientid ID de uma conta no Wallarm Cloud para preencher/ler a lista de IPs.
ip_rule.list O tipo de lista de IPs para adicionar objetos, pode ser: black (para a lista de negação), white (para a lista de permissões), gray (para a lista cinza).
ip_rule.rule_type O tipo de objetos a adicionar à lista:
  • ip_range se estiver adicionando IPs ou sub-redes específicas
  • country se estiver adicionando países ou regiões
  • proxy_type se estiver adicionando serviços proxy (VPN, SES, PUB, WEB, TOR)
  • datacenter para outros tipos de fontes (rackspace, tencent, plusserver, ovh, oracle, linode, ibm, huawei, hetzner, gce, azure, aws, alibaba)
ip_rule.subnet
(rule_type:"ip_range")
IP ou sub-rede para adicionar à lista, por exemplo, "1.1.1.1".
ip_rule.source_values
(para outros valores rule_type)
Uma das opções:
  • Se rule_type:"country" - array de países no formato ISO-3166, por exemplo, ["AX","AL"].
  • Se rule_type:"proxy_type" - array de serviços proxy, por exemplo, ["VPN","PUB"].
  • Se rule_type:"datacenter" - array de outros tipos de fontes, por exemplo, ["rackspace","huawei"].
ip_rule.pools Array de IDs de aplicações para permitir ou restringir o acesso para IPs, por exemplo, [3,4] para IDs de aplicações 3 e 4 ou [0] para todas as aplicações.
ip_rule.expired_at Data do Unix Timestamp para remover os IPs da lista. O valor máximo é para sempre (33223139044).
reason Motivo para permitir ou restringir o acesso para IPs.
force Se true e alguns objetos especificados na solicitação já estão na lista de IPs, o script sobrescreverá-os.

Adicionar à lista as entradas do arquivo .csv

Para adicionar à lista os IPs ou sub-redes do arquivo .csv, use o seguinte script bash:

#!/bin/bash

UUID="<SEU_UUID>"
SECRET="<SUA_CHAVE_SECRETA>"
CLIENT="<SEU_ID_CLIENTE>"
LIST="<TIPO_DE_LISTA_IP>"
PATH_TO_CSV_FILE="<CAMINHO_PARA_ARQUIVO_CSV>" # caminho para o arquivo CSV com IPs ou subnets
APPLICATIONS="<IDs_DO_APP_ATRAVES_DE_VIRGULA>"
REMOVE_DATE="DATA_TIMESTAMP_REMOVER"
REASON='<MOTIVO>'
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: <SEU_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="<SEU_UUID>"
SECRET="<SUA_CHAVE_SECRETA>"
CLIENT="<SEU_ID_CLIENTE>"
LIST="<TIPO_DE_LISTA_IP>"
PATH_TO_CSV_FILE="<CAMINHO_PARA_ARQUIVO_CSV>" # caminho para o arquivo CSV com IPs ou subnets
APPLICATIONS="<IDs_DO_APP_ATRAVES_DE_VIRGULA>"
REMOVE_DATE="DATA_TIMESTAMP_REMOVER"
REASON='<MOTIVO>'
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: <SEU_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

Adicionar à lista um único IP ou sub-rede

Para adicionar IPs específicos ou sub-redes à lista de IPs, envie a seguinte solicitação para cada IP/sub-rede:

curl 'https://us1.api.wallarm.com/v4/ip_rules' \
  -H 'X-WallarmApi-Token: <SEU_TOKEN>' \
  -H "accept: application/json" \
  -H "Content-Type: application/json" \
  --data-raw '{"clientid":<SEU_ID_DE_CLIENTE>,"force":false,"ip_rule":{"list":"<TIPO_DE_LISTA_DE_IP>","reason":"<MOTIVO_PARA_ADICIONAR_ENTRIES_A_LISTA>","pools":[<ARRAY_DE_IDS_DE_APLICATIVOS>],"expired_at":<DATA_DE_REMOÇÃO_TIMESTAMP>,"rule_type":"ip_range","subnet":"<IP_OU_SUB-REDE>"}}'
curl 'https://api.wallarm.com/v4/ip_rules' \
  -H 'X-WallarmApi-Token: <SEU_TOKEN>' \
  -H "accept: application/json" \
  -H "Content-Type: application/json" \
  --data-raw '{"clientid":<SEU_ID_DE_CLIENTE>,"force":false,"ip_rule":{"list":"<TIPO_DE_LISTA_DE_IP>","reason":"<MOTIVO_PARA_ADICIONAR_ENTRIES_A_LISTA>","pools":[<ARRAY_DE_IDS_DE_APLICATIVOS>],"expired_at":<DATA_DE_REMOÇÃO_TIMESTAMP>,"rule_type":"ip_range","subnet":"<IP_OU_SUB-REDE>"}}'

Adicionar à lista vários países

curl 'https://us1.api.wallarm.com/v4/ip_rules' \
  -H 'X-WallarmApi-Token: <SEU_TOKEN>' \
  -H "accept: application/json" \
  -H "Content-Type: application/json" \
  --data-raw '{"clientid":<SEU_ID_CLIENTE>,"ip_rule":{"list":"<TIPO_DE_LISTA_IP>","rule_type":"country","source_values":[<ARRAY_DE_PAÍSES_REGIÕES>],"pools":[<ARRAY_DE_IDS_APP>],"expired_at":"<TIMESTAMP_DATA_REMOÇÃO>","reason":"<RAZÃO_PARA_ADICIONAR_ENTRADAS_À_LISTA>"},"force":false}'
curl 'https://api.wallarm.com/v4/ip_rules' \
  -H 'X-WallarmApi-Token: <SEU_TOKEN>' \
  -H "accept: application/json" \
  -H "Content-Type: application/json" \
  --data-raw '{"clientid":<SEU_ID_CLIENTE>,"ip_rule":{"list":"<TIPO_DE_LISTA_IP>","rule_type":"country","source_values":[<ARRAY_DE_PAÍSES_REGIÕES>],"pools":[<ARRAY_DE_IDS_APP>],"expired_at":"<TIMESTAMP_DATA_REMOÇÃO>","reason":"<RAZÃO_PARA_ADICIONAR_ENTRADAS_À_LISTA>"},"force":false}'

Adicionar à lista vários serviços de proxy

curl 'https://us1.api.wallarm.com/v4/ip_rules' \
  -H 'X-WallarmApi-Token: <SEU_TOKEN>' \
  -H "accept: application/json" \
  -H "Content-Type: application/json" \
  --data-raw '{"clientid":<SEU_ID_CLIENTE>,"ip_rule":{"list":"<TIPO_DA_LISTA_IP>","rule_type":"proxy_type","source_values":[<ARRAY_DE_SERVICOS_PROXY>],"pools":[<ARRAY_DE_IDS_APP>],"expired_at":"<TIMESTAMP_REMOVER_DATA>","reason":"<MOTIVO_PARA_ADICIONAR_ENTRADAS_A_LISTA>"},"force":false}'
curl 'https://api.wallarm.com/v4/ip_rules' \
  -H 'X-WallarmApi-Token: <SEU_TOKEN>' \
  -H "accept: application/json" \
  -H "Content-Type: application/json" \
  --data-raw '{"clientid":<SEU_ID_CLIENTE>,"ip_rule":{"list":"<TIPO_DA_LISTA_IP>","rule_type":"proxy_type","source_values":[<ARRAY_DE_SERVICOS_PROXY>],"pools":[<ARRAY_DE_IDS_APP>],"expired_at":"<TIMESTAMP_REMOVER_DATA>","reason":"<MOTIVO_PARA_ADICIONAR_ENTRADAS_A_LISTA>"},"force":false}'

Excluir um objeto da lista de IPs

Os objetos são excluídos das listas de IPs por seus IDs.

Para obter um ID de objeto, solicite o conteúdo da lista de IPs e copie objects.id do objeto necessário de uma resposta:

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

Tendo o ID do objeto, envie a seguinte solicitação para excluí-lo da lista:

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

Você pode excluir vários objetos de uma vez passando seus IDs como uma matriz na solicitação de exclusão.