Дерево страниц

Пример запроса на отправку одного файла:

curl -X 'POST' \
  'https://server.company.ru/xapi/push/event' \
  -H 'accept: application/json' \
  -H 'X-API-Auth-Token: brse99dugp1cdbr69axz' \
  -H 'X-API-CompanyId: IW' \
  -H 'X-API-Version: 1' \
  -H 'Content-Type: multipart/form-data' \
  -H 'X-Enable-OpenAPI: 1' \
  -F 'event={
  "evt_class": 4,
  "evt_service": "network_resource",
  "evt_attributes": [
    {
      "name": "event_name",
      "value": "network_resource event"
    },
    {
      "name": "capture_ts",
      "value": "2025-05-28T13:19:41+03:00"
    },
    {
      "name": "capture_server_ip",
      "value": "127.0.0.1"
    },
    {
      "name": "capture_server_fqdn",
      "value": "localhost"
    }
  ],
  "evt_senders": [
    {
      "identity_id": 3,
      "identity_type": 0,
      "identity_contacts": [
        {
          "name": "auth",
          "value": "user_name@iw"
        }
      ]
    },
    {
      "identity_id": 4,
      "identity_type": 1,
      "identity_contacts": [
        {
          "name": "dnshostname",
          "value": "localhost.computer.domain"
        }
      ],
      "identity_attributes": [
        {
          "name": "workstation_type",
          "value": "ws_type_computer"
        }
      ]
    }
  ],
  "evt_receivers": [
    {
      "identity_id": 2,
      "identity_type": 3,
      "identity_contacts": [],
      "identity_attributes": [
        {
          "name": "res_destination_host",
          "value": "test.com"
        },
        {
          "name": "res_destination_url",
          "value": "test.com/folder/ "
        }
      ]
    }
  ],
  "evt_data": [
    {
      "data_id": 2,
      "data_attributes": [
        {
          "name": "filename",
          "value": "/root/test.png"
        },
        {
          "name": "destination_file_path",
          "value": "Send file here"
        }
      ]
    }
  ]
}' \
  -F 'files[]=@2'  

Пример запроса на отправку нескольких файлов:

curl -X 'POST' \
  'https://server.company.ru/xapi/push/event' \
  -H 'accept: application/json' \
  -H 'X-API-Auth-Token: brse99dugp1cdbr69axz' \
  -H 'X-API-CompanyId: IW' \
  -H 'X-API-Version: 1' \
  -H 'Content-Type: multipart/form-data' \
  -H 'X-Enable-OpenAPI: 1' \
  -F 'event={
  "evt_class": 4,
  "evt_service": "network_resource",
  "evt_attributes": [
    {
      "name": "event_name",
      "value": "network_resource event"
    },
    {
      "name": "capture_ts",
      "value": "2025-06-03T16:17:41+03:00"
    },
    {
      "name": "capture_server_ip",
      "value": "127.0.0.1"
    },
    {
      "name": "capture_server_fqdn",
      "value": "localhost"
    }
  ],
  "evt_senders": [
    {
      "identity_id": 3,
      "identity_type": 0,
      "identity_contacts": [
        {
          "name": "auth",
          "value": "user_name@iw"
        }
      ]
    },
    {
      "identity_id": 4,
      "identity_type": 1,
      "identity_contacts": [
        {
          "name": "dnshostname",
          "value": "localhost.computer.domain"
        }
      ],
      "identity_attributes": [
        {
          "name": "workstation_type",
          "value": "ws_type_computer"
        }
      ]
    }
  ],
  "evt_receivers": [
    {
      "identity_id": 2,
      "identity_type": 3,
      "identity_contacts": [],
      "identity_attributes": [
        {
          "name": "res_destination_host",
          "value": "test.com"
        },
        {
          "name": "res_destination_url",
          "value": "test.com/folder/ "
        }
      ]
    }
  ],
  "evt_data": [
    {
      "data_id": 0,
      "data_attributes": [
        {
          "name": "filename",
          "value": "/root/test.png"
        },
        {
          "name": "destination_file_path",
          "value": "Send file here"
        }
      ]
    },
    {
      "data_id": 1,
      "data_attributes": [
        {
          "name": "filename",
          "value": "/root/test1.png"
        },
        {
          "name": "destination_file_path",
          "value": "Send1 file here"
        }
      ]
    }
  ]
}
' \
  -F 'files[]=@/root/test.png;filename=0' \
  -F 'files[]=@/root/test1.png;filename=1'

Примечание:

В узле -F значение переменной filename соответствует значению поля data_id.

  • Нет меток