add findings
curl --request POST \
--url https://api.example.com/security/findings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"version_id": "<string>",
"findings": [
{
"location": {
"strategy": "node_id",
"scope_id": "<string>",
"location_id": "<string>"
},
"source": "<string>",
"metadata": {
"type": "<string>",
"name": "<string>",
"explanation": "<string>",
"recommendation": "<string>",
"reference": "<string>"
}
}
]
}
'import requests
url = "https://api.example.com/security/findings"
payload = {
"version_id": "<string>",
"findings": [
{
"location": {
"strategy": "node_id",
"scope_id": "<string>",
"location_id": "<string>"
},
"source": "<string>",
"metadata": {
"type": "<string>",
"name": "<string>",
"explanation": "<string>",
"recommendation": "<string>",
"reference": "<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({
version_id: '<string>',
findings: [
{
location: {strategy: 'node_id', scope_id: '<string>', location_id: '<string>'},
source: '<string>',
metadata: {
type: '<string>',
name: '<string>',
explanation: '<string>',
recommendation: '<string>',
reference: '<string>'
}
}
]
})
};
fetch('https://api.example.com/security/findings', 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://api.example.com/security/findings",
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([
'version_id' => '<string>',
'findings' => [
[
'location' => [
'strategy' => 'node_id',
'scope_id' => '<string>',
'location_id' => '<string>'
],
'source' => '<string>',
'metadata' => [
'type' => '<string>',
'name' => '<string>',
'explanation' => '<string>',
'recommendation' => '<string>',
'reference' => '<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://api.example.com/security/findings"
payload := strings.NewReader("{\n \"version_id\": \"<string>\",\n \"findings\": [\n {\n \"location\": {\n \"strategy\": \"node_id\",\n \"scope_id\": \"<string>\",\n \"location_id\": \"<string>\"\n },\n \"source\": \"<string>\",\n \"metadata\": {\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"explanation\": \"<string>\",\n \"recommendation\": \"<string>\",\n \"reference\": \"<string>\"\n }\n }\n ]\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://api.example.com/security/findings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"version_id\": \"<string>\",\n \"findings\": [\n {\n \"location\": {\n \"strategy\": \"node_id\",\n \"scope_id\": \"<string>\",\n \"location_id\": \"<string>\"\n },\n \"source\": \"<string>\",\n \"metadata\": {\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"explanation\": \"<string>\",\n \"recommendation\": \"<string>\",\n \"reference\": \"<string>\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/security/findings")
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 \"version_id\": \"<string>\",\n \"findings\": [\n {\n \"location\": {\n \"strategy\": \"node_id\",\n \"scope_id\": \"<string>\",\n \"location_id\": \"<string>\"\n },\n \"source\": \"<string>\",\n \"metadata\": {\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"explanation\": \"<string>\",\n \"recommendation\": \"<string>\",\n \"reference\": \"<string>\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"version": {
"id": "<string>",
"analysis_id": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"origin_finding_id": "<string>",
"is_acknowledged": true,
"type": "<string>",
"level": "critical",
"name": "<string>",
"explanation": "<string>",
"source": "<string>",
"id": "<string>",
"node_id": "<string>",
"is_borrowed": true,
"created_by_user": {
"id": "<string>",
"is_self": true,
"created_at": "2023-11-07T05:31:56Z",
"username": "<string>"
},
"project_id": "<string>",
"project_slug": "<string>",
"code_version_id": "<string>",
"actions": {
"can_edit": true,
"can_revert": true,
"can_delete": true
},
"recommendation": "<string>",
"reference": "<string>",
"location_id": "<string>",
"operation": "add"
}
]
}{
"code": "auth.session_expired",
"message": "<string>"
}finding
add findings
stage one or more new findings on an analysis version. Changes are not applied until the version is committed.
POST
/
security
/
findings
add findings
curl --request POST \
--url https://api.example.com/security/findings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"version_id": "<string>",
"findings": [
{
"location": {
"strategy": "node_id",
"scope_id": "<string>",
"location_id": "<string>"
},
"source": "<string>",
"metadata": {
"type": "<string>",
"name": "<string>",
"explanation": "<string>",
"recommendation": "<string>",
"reference": "<string>"
}
}
]
}
'import requests
url = "https://api.example.com/security/findings"
payload = {
"version_id": "<string>",
"findings": [
{
"location": {
"strategy": "node_id",
"scope_id": "<string>",
"location_id": "<string>"
},
"source": "<string>",
"metadata": {
"type": "<string>",
"name": "<string>",
"explanation": "<string>",
"recommendation": "<string>",
"reference": "<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({
version_id: '<string>',
findings: [
{
location: {strategy: 'node_id', scope_id: '<string>', location_id: '<string>'},
source: '<string>',
metadata: {
type: '<string>',
name: '<string>',
explanation: '<string>',
recommendation: '<string>',
reference: '<string>'
}
}
]
})
};
fetch('https://api.example.com/security/findings', 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://api.example.com/security/findings",
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([
'version_id' => '<string>',
'findings' => [
[
'location' => [
'strategy' => 'node_id',
'scope_id' => '<string>',
'location_id' => '<string>'
],
'source' => '<string>',
'metadata' => [
'type' => '<string>',
'name' => '<string>',
'explanation' => '<string>',
'recommendation' => '<string>',
'reference' => '<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://api.example.com/security/findings"
payload := strings.NewReader("{\n \"version_id\": \"<string>\",\n \"findings\": [\n {\n \"location\": {\n \"strategy\": \"node_id\",\n \"scope_id\": \"<string>\",\n \"location_id\": \"<string>\"\n },\n \"source\": \"<string>\",\n \"metadata\": {\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"explanation\": \"<string>\",\n \"recommendation\": \"<string>\",\n \"reference\": \"<string>\"\n }\n }\n ]\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://api.example.com/security/findings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"version_id\": \"<string>\",\n \"findings\": [\n {\n \"location\": {\n \"strategy\": \"node_id\",\n \"scope_id\": \"<string>\",\n \"location_id\": \"<string>\"\n },\n \"source\": \"<string>\",\n \"metadata\": {\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"explanation\": \"<string>\",\n \"recommendation\": \"<string>\",\n \"reference\": \"<string>\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/security/findings")
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 \"version_id\": \"<string>\",\n \"findings\": [\n {\n \"location\": {\n \"strategy\": \"node_id\",\n \"scope_id\": \"<string>\",\n \"location_id\": \"<string>\"\n },\n \"source\": \"<string>\",\n \"metadata\": {\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"explanation\": \"<string>\",\n \"recommendation\": \"<string>\",\n \"reference\": \"<string>\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"version": {
"id": "<string>",
"analysis_id": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"origin_finding_id": "<string>",
"is_acknowledged": true,
"type": "<string>",
"level": "critical",
"name": "<string>",
"explanation": "<string>",
"source": "<string>",
"id": "<string>",
"node_id": "<string>",
"is_borrowed": true,
"created_by_user": {
"id": "<string>",
"is_self": true,
"created_at": "2023-11-07T05:31:56Z",
"username": "<string>"
},
"project_id": "<string>",
"project_slug": "<string>",
"code_version_id": "<string>",
"actions": {
"can_edit": true,
"can_revert": true,
"can_delete": true
},
"recommendation": "<string>",
"reference": "<string>",
"location_id": "<string>",
"operation": "add"
}
]
}{
"code": "auth.session_expired",
"message": "<string>"
}⌘I
