Request
curl --request POST \
--url https://{region}.api.plerion.com/v1/tenant/workload/scans \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"integrationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"assetId": "prn:assets:06b6fb23-faa4-45d0-8809-45958c991990:aws:ec2:instance:ap-southeast-2:i-0123456789abcdef0",
"resourceRegion": "ap-southeast-2",
"resourceId": "i-0123456789abcdef0"
}
'import requests
url = "https://{region}.api.plerion.com/v1/tenant/workload/scans"
payload = {
"integrationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"assetId": "prn:assets:06b6fb23-faa4-45d0-8809-45958c991990:aws:ec2:instance:ap-southeast-2:i-0123456789abcdef0",
"resourceRegion": "ap-southeast-2",
"resourceId": "i-0123456789abcdef0"
}
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({
integrationId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
assetId: 'prn:assets:06b6fb23-faa4-45d0-8809-45958c991990:aws:ec2:instance:ap-southeast-2:i-0123456789abcdef0',
resourceRegion: 'ap-southeast-2',
resourceId: 'i-0123456789abcdef0'
})
};
fetch('https://{region}.api.plerion.com/v1/tenant/workload/scans', 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://{region}.api.plerion.com/v1/tenant/workload/scans",
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([
'integrationId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'assetId' => 'prn:assets:06b6fb23-faa4-45d0-8809-45958c991990:aws:ec2:instance:ap-southeast-2:i-0123456789abcdef0',
'resourceRegion' => 'ap-southeast-2',
'resourceId' => 'i-0123456789abcdef0'
]),
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://{region}.api.plerion.com/v1/tenant/workload/scans"
payload := strings.NewReader("{\n \"integrationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"assetId\": \"prn:assets:06b6fb23-faa4-45d0-8809-45958c991990:aws:ec2:instance:ap-southeast-2:i-0123456789abcdef0\",\n \"resourceRegion\": \"ap-southeast-2\",\n \"resourceId\": \"i-0123456789abcdef0\"\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://{region}.api.plerion.com/v1/tenant/workload/scans")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"integrationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"assetId\": \"prn:assets:06b6fb23-faa4-45d0-8809-45958c991990:aws:ec2:instance:ap-southeast-2:i-0123456789abcdef0\",\n \"resourceRegion\": \"ap-southeast-2\",\n \"resourceId\": \"i-0123456789abcdef0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{region}.api.plerion.com/v1/tenant/workload/scans")
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 \"integrationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"assetId\": \"prn:assets:06b6fb23-faa4-45d0-8809-45958c991990:aws:ec2:instance:ap-southeast-2:i-0123456789abcdef0\",\n \"resourceRegion\": \"ap-southeast-2\",\n \"resourceId\": \"i-0123456789abcdef0\"\n}"
response = http.request(request)
puts response.read_body{
"scanId": "<string>",
"status": "PENDING",
"executionId": "<string>"
}{
"errors": [
{
"field": "<string>",
"code": "<string>",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "IntegrationAccessDenied",
"message": "integration access denied"
}
]
}{
"errors": [
{
"code": "ResourceNotFound",
"message": "Integration not found"
}
]
}{
"errors": [
{
"code": "InvalidResource",
"message": "Resource not supported for scanning"
}
]
}{
"message": "Internal server error"
}Request a workload scan
Use the request workload scan API to scan one workload now instead of waiting for the next scheduled scan. Name the integration and either the Plerion asset ID of the workload or the provider’s resource type, region, and ID. Supported resource types are EC2 instances (ec2:instance) and AMIs (ec2:image).
The response carries the scan ID to poll with the get workload scan API. If a scan of the same workload is already pending, its ID is returned instead of starting another.
A key whose role covers specific integrations can request scans only in those integrations.
POST
/
v1
/
tenant
/
workload
/
scans
Request
curl --request POST \
--url https://{region}.api.plerion.com/v1/tenant/workload/scans \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"integrationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"assetId": "prn:assets:06b6fb23-faa4-45d0-8809-45958c991990:aws:ec2:instance:ap-southeast-2:i-0123456789abcdef0",
"resourceRegion": "ap-southeast-2",
"resourceId": "i-0123456789abcdef0"
}
'import requests
url = "https://{region}.api.plerion.com/v1/tenant/workload/scans"
payload = {
"integrationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"assetId": "prn:assets:06b6fb23-faa4-45d0-8809-45958c991990:aws:ec2:instance:ap-southeast-2:i-0123456789abcdef0",
"resourceRegion": "ap-southeast-2",
"resourceId": "i-0123456789abcdef0"
}
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({
integrationId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
assetId: 'prn:assets:06b6fb23-faa4-45d0-8809-45958c991990:aws:ec2:instance:ap-southeast-2:i-0123456789abcdef0',
resourceRegion: 'ap-southeast-2',
resourceId: 'i-0123456789abcdef0'
})
};
fetch('https://{region}.api.plerion.com/v1/tenant/workload/scans', 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://{region}.api.plerion.com/v1/tenant/workload/scans",
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([
'integrationId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'assetId' => 'prn:assets:06b6fb23-faa4-45d0-8809-45958c991990:aws:ec2:instance:ap-southeast-2:i-0123456789abcdef0',
'resourceRegion' => 'ap-southeast-2',
'resourceId' => 'i-0123456789abcdef0'
]),
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://{region}.api.plerion.com/v1/tenant/workload/scans"
payload := strings.NewReader("{\n \"integrationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"assetId\": \"prn:assets:06b6fb23-faa4-45d0-8809-45958c991990:aws:ec2:instance:ap-southeast-2:i-0123456789abcdef0\",\n \"resourceRegion\": \"ap-southeast-2\",\n \"resourceId\": \"i-0123456789abcdef0\"\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://{region}.api.plerion.com/v1/tenant/workload/scans")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"integrationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"assetId\": \"prn:assets:06b6fb23-faa4-45d0-8809-45958c991990:aws:ec2:instance:ap-southeast-2:i-0123456789abcdef0\",\n \"resourceRegion\": \"ap-southeast-2\",\n \"resourceId\": \"i-0123456789abcdef0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{region}.api.plerion.com/v1/tenant/workload/scans")
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 \"integrationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"assetId\": \"prn:assets:06b6fb23-faa4-45d0-8809-45958c991990:aws:ec2:instance:ap-southeast-2:i-0123456789abcdef0\",\n \"resourceRegion\": \"ap-southeast-2\",\n \"resourceId\": \"i-0123456789abcdef0\"\n}"
response = http.request(request)
puts response.read_body{
"scanId": "<string>",
"status": "PENDING",
"executionId": "<string>"
}{
"errors": [
{
"field": "<string>",
"code": "<string>",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "IntegrationAccessDenied",
"message": "integration access denied"
}
]
}{
"errors": [
{
"code": "ResourceNotFound",
"message": "Integration not found"
}
]
}{
"errors": [
{
"code": "InvalidResource",
"message": "Resource not supported for scanning"
}
]
}{
"message": "Internal server error"
}Authorizations
Headers
Body
application/json
Provide assetId alone, or resourceType, resourceRegion, and resourceId together.
Was this page helpful?