Create an image target
curl --request POST \
--url https://sreagent.app/api/v1/config/image_targets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"image_ref": "<string>"
}
'import requests
url = "https://sreagent.app/api/v1/config/image_targets"
payload = { "image_ref": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({image_ref: '<string>'})
};
fetch('https://sreagent.app/api/v1/config/image_targets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sreagent.app/api/v1/config/image_targets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'image_ref' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sreagent.app/api/v1/config/image_targets"
payload := strings.NewReader("{\n \"image_ref\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sreagent.app/api/v1/config/image_targets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"image_ref\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sreagent.app/api/v1/config/image_targets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image_ref\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"error": "<string>",
"message": "<string>"
}image_targets
Create an image target
Scan a container image for known vulnerabilities. The platform scans the image’s packages and records what is known against them, so name the image the way the registry does, tag and all (registry.example.com/api:1.4.2). One row per image per organization: an image two clusters run is one target, and adding one that discovery already filed is refused as taken. The first scan runs on the next scheduled scan; scan_image_now runs one at once. Included in the Business and Enterprise plans.
POST
/
image_targets
Create an image target
curl --request POST \
--url https://sreagent.app/api/v1/config/image_targets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"image_ref": "<string>"
}
'import requests
url = "https://sreagent.app/api/v1/config/image_targets"
payload = { "image_ref": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({image_ref: '<string>'})
};
fetch('https://sreagent.app/api/v1/config/image_targets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sreagent.app/api/v1/config/image_targets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'image_ref' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sreagent.app/api/v1/config/image_targets"
payload := strings.NewReader("{\n \"image_ref\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sreagent.app/api/v1/config/image_targets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"image_ref\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sreagent.app/api/v1/config/image_targets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image_ref\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"error": "<string>",
"message": "<string>"
}Authorizations
Body
application/json
Response
Created.
Was this page helpful?