Fetch Scan Result
Fetch the result of a previously submitted NSFW (Not Safe for Work) image scan job.
Request parameters
curl https://eu1.api.av.ionxsolutions.com/v1/nsfw/images/24723ab3-3979-4e77-a61a-20f73356b465 \
--header 'X-API-Key: YOUR_API_KEY'
const axios = require('axios');
const api = axios.create({
baseURL: 'https://eu1.api.av.ionxsolutions.com/v1/'
});
// ID of the scan to fetch the result for
const scanId = "24723ab3-3979-4e77-a61a-20f73356b465";
api.get(`malware/${scanId}`, {
headers: {
'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");
// ID of the scan to fetch the result for
var scanId = "24723ab3-3979-4e77-a61a-20f73356b465";
using var response = await client.GetAsync($"malware/{scanId}");
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import java.io.IOException;
String apiKey = "YOUR_API_KEY";
// ID of the scan to fetch the result for
String scanId = "24723ab3-3979-4e77-a61a-20f73356b465";
String url = String.format("https://eu1.api.av.ionxsolutions.com/v1/nsfw/images/%s", scanId);
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url(url)
.addHeader("X-API-Key", apiKey)
.get()
.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
# ID of the scan to fetch the result for
scan_id = "24723ab3-3979-4e77-a61a-20f73356b465"
url = 'https://eu1.api.av.ionxsolutions.com/v1/nsfw/images/' + scan_id
headers = {
'X-API-Key': 'YOUR_API_KEY'
}
response = requests.get(url, headers=headers)
print(response.text)
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
apiKey := "YOUR_API_KEY"
// ID of the scan to fetch the result for
scanId := "24723ab3-3979-4e77-a61a-20f73356b465"
url := fmt.Sprintf("https://eu1.api.av.ionxsolutions.com/v1/nsfw/images/%s", scanId)
req, _ := http.NewRequest("GET", url, nil)
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 == 200 {
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'
# ID of the scan to fetch the result for
scan_id = "24723ab3-3979-4e77-a61a-20f73356b465"
url = URI.parse("https://eu1.api.av.ionxsolutions.com/v1/nsfw/images/#{scan_id}")
request = Net::HTTP::Get.new(url)
request['X-API-Key'] = 'YOUR_API_KEY'
response = Net::HTTP.start(url.hostname, url.port, use_ssl: true) do |http|
http.request(request)
end
puts response.body
<?php
// ID of the scan to fetch the result for
const scanId = "24723ab3-3979-4e77-a61a-20f73356b465";
$url = 'https://eu1.api.av.ionxsolutions.com/v1/nsfw/images/'.$scan_id;
$api_key = 'YOUR_API_KEY';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$headers = array();
$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 != 200) {
die('HTTP error: Status code '.$http_code);
}
echo $result;
# ID of the scan to fetch the result for
$ScanId = "24723ab3-3979-4e77-a61a-20f73356b465";
$Uri = "https://eu1.api.av.ionxsolutions.com/v1/nsfw/images/${ScanId}"
$Headers = @{
"X-API-Key" = "YOUR_API_KEY"
};
$Result = Invoke-RestMethod -Uri $Uri -Method Get -Headers $Headers
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": "eb0de022-edd2-4ea4-bdd6-29dc9d4d6520",
"scan_type": "nsfw_image",
"status": "threat",
"content_length": 3193814,
"content_type": "image/gif",
"signals": [
"Classification:Pornography"
],
"metadata": {
"hash_sha1": "bb4e106b15a50b5aa88fb7ed38f5fb13bb781be0",
"hash_sha256": "505124cc217cf79acb3b0cf0410a344a68eadfee3817e159f7b7c2be02433cdc",
"classification_clean": "0.00",
"classification_pornography": "0.99",
"classification_sexy": "0.01"
},
"created_at": "2024-11-05T13:28:24.453596+00:00",
"completed_at": "2024-11-05T13:28:26.828018+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/nsfw/images/de72a6bb-75bd-4c2a-8202-1401e9fc4f3a",
"errors": {
"id": [
"NSFW Image Job de72a6bb-75bd-4c2a-8202-1401e9fc4f3a could not be found"
]
},
"traceId": "00-325f8534c00275562309bfbc9f26438e-a6551685b57f580d-01"
}
Last modified: 08 November 2024