API Docs Help

Scan URL

POST method/v1/malware/scan/url

Downloads and scans a file for malware.

Request parameters

curl https://eu1.api.av.ionxsolutions.com/v1/malware/scan/url \ --header 'X-API-Key: YOUR_API_KEY' \ --header 'Content-Type: application/json' \ --data '{"file_url":"https://www.example.com/a-file","file_name":"file.pdf"}'
const axios = require('axios'); const api = axios.create({ baseURL: 'https://eu1.api.av.ionxsolutions.com/v1/' }); const payload = { 'file_url': 'https://www.example.com/a-file', 'file_name': 'file.pdf' }; api.post('malware/scan/url', payload, { headers: { 'Content-Type': 'application/json', 'X-API-Key': 'YOUR_API_KEY' } }).then(res => { console.log('response', res.data); }).catch(err => { console.log('error', err); });
using var client = new HttpClient(); client.BaseAddress = new Uri("https://eu1.api.av.ionxsolutions.com/v1/"); client.DefaultRequestHeaders.Add("X-API-Key", "YOUR_API_KEY"); var payload = JsonContent.Create(new { file_url = "https://www.example.com/a-file", file_name = "file.pdf" }); using var response = await client.PostAsync("malware/scan/url", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);
import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.RequestBody; import okhttp3.Request; import okhttp3.Response; import java.io.IOException; String apiKey = "YOUR_API_KEY"; String url = "https://eu1.api.av.ionxsolutions.com/v1/malware/scan/url"; OkHttpClient client = new OkHttpClient(); MediaType mediaType = MediaType.parse("application/json"); String json = "{" + " \"file_url\":\"https://pdfobject.com/pdf/sample.pdf\"," + " \"file_name\":\"file.pdf\"" + "}"; RequestBody payload = RequestBody.create(json, mediaType); Request request = new Request.Builder() .url(url) .addHeader("X-API-Key", apiKey) .post(payload) .build(); Response response = client.newCall(request).execute(); if (response.isSuccessful()) { System.out.println(response.body().string()); } else { System.err.println("Request failed. Status code: " + response.code()); System.err.println("Response message: " + response.message()); System.err.println(response.body().string()); }
import requests url = 'https://eu1.api.av.ionxsolutions.com/v1/malware/scan/url' headers = { 'X-API-Key': 'YOUR_API_KEY' } payload = { 'file_url': 'https://pdfobject.com/pdf/sample.pdf', 'file_name': 'file.pdf' } response = requests.post(url, headers=headers, json=payload) print(response.text)
package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { apiKey := "YOUR_API_KEY" url := "https://eu1.api.av.ionxsolutions.com/v1/malware/scan/url" payload, err := json.Marshal(map[string]interface{}{ "file_url": "https://pdfobject.com/pdf/sample.pdf", "file_name": "file.pdf", }) if err != nil { fmt.Println(err) return } req, _ := http.NewRequest("POST", url, bytes.NewBuffer(payload)) req.Header.Set("Content-Type", "application/json") req.Header.Set("X-API-Key", apiKey) client := &http.Client{} resp, err := client.Do(req) if err != nil { fmt.Println(err) return } defer resp.Body.Close() if resp.StatusCode == 201 { var respBuffer bytes.Buffer io.Copy(&respBuffer, resp.Body) fmt.Println(respBuffer.String()) } else { fmt.Printf("Request failed. Status code: %d\n", resp.StatusCode) } }
require 'net/http' require 'json' require 'uri' url = URI.parse('https://eu1.api.av.ionxsolutions.com/v1/malware/scan/file') request = Net::HTTP::Post.new(url) request['Content-Type'] = 'application/json' request['X-API-Key'] = 'YOUR_API_KEY' payload = { :file_url => 'https://pdfobject.com/pdf/sample.pdf', :file_name => 'file.pdf' } request.body = payload.to_json response = Net::HTTP.start(url.hostname, url.port, use_ssl: true) do |http| http.request(request) end puts response.body
<?php $url = 'https://eu1.api.av.ionxsolutions.com/v1/malware/scan/url'; $api_key = 'YOUR_API_KEY'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $payload = [ 'file_url' => 'https://pdfobject.com/pdf/sample.pdf', 'file_name' => 'file.pdf' ]; curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($payload)); $headers = array(); $headers[] = 'Content-Type: application/json'; $headers[] = 'X-API-Key: '.$api_key; curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($curl); if ($result === false) { curl_close($curl); die('Curl error: '.curl_error($curl).'('.curl_errno($curl).')'); } $http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); if ($http_code != 201) { die('HTTP error: Status code '.$http_code); } echo $result;
$Uri = "https://eu1.api.av.ionxsolutions.com/v1/malware/scan/url" $Headers = @{ "Content-Type" = "application/json"; "X-API-Key" = "YOUR_API_KEY" }; $Payload = @{ "file_url" = "https://pdfobject.com/pdf/sample.pdf" "file_name" = "file.pdf" } | ConvertTo-Json $Result = Invoke-RestMethod -Uri $Uri -Method Post -Headers $Headers -Body $Payload Write-Host ($Result | ConvertTo-Json)

Responses

{ "type": "https://tools.ietf.org/html/rfc9110#section-15.6.1", "title": "Internal Server Error", "status": 500, "detail": "Something went wrong", "traceId": "00-17d017df2498eac9e698f1a06747a161-c9d4f32199479052-01" }
{ "id": "5a53b6f5-871a-495a-8972-b8d0dcb80844", "scan_type": "malware", "status": "threat", "content_length": 68, "content_type": "text/plain", "signals": [ "Virus:EICAR_Test_File" ], "metadata": { "hash_sha1": "3395856ce81f2b7382dee72602f798b642f14140", "hash_sha256": "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" }, "created_at": "2024-10-18T12:43:01.881738+00:00", "completed_at": "2024-10-18T12:43:02.214356+00:00" }
{ "type": "https://datatracker.ietf.org/doc/html/rfc7807#section-15.5.21", "title": "One or more validation errors occurred.", "status": 422, "instance": "/v1/malware/scan/url", "errors": { "file_url": [ "'file_url' must not be empty" ] }, "traceId": "00-f4ee9395de696115b3b8af12e193c3d0-3b2749428bed3231-01" }
Last modified: 08 November 2024