Attest Sonar scan
curl --request POST \
--url https://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/sonar \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'data_json={
"attestation_name": "<string>",
"sonar_results": {
"analysedAt": "<string>",
"revision": "<string>",
"project": {
"key": "<string>",
"url": "<string>",
"name": ""
},
"serverUrl": "<string>",
"taskId": "<string>",
"status": "<string>",
"changedAt": "<string>",
"qualityGate": {
"status": "<string>",
"conditions": [
{
"metric": "<string>",
"errorThreshold": "<string>",
"operator": "<string>",
"status": "<string>",
"value": "<string>",
"onLeakPeriod": true
}
],
"name": "<string>"
}
},
"origin_url": "<string>",
"description": "<string>",
"artifact_fingerprint": "<string>",
"target_artifacts": [
"<string>"
],
"git_commit_info": {
"sha1": "<string>",
"message": "<string>",
"author": "<string>",
"author_username": "<string>",
"branch": "<string>",
"timestamp": 123,
"url": "<string>",
"parents": [
"<string>"
],
"verified": true,
"signature_state": "<string>"
},
"repo_info": {
"name": "<string>",
"url": "<string>",
"id": "<string>",
"description": "<string>"
},
"external_urls": {},
"annotations": {},
"user_data": {}
}' \
--form 'attachment_file=<string>'import requests
url = "https://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/sonar"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data_json\"\r\n\r\n{\r\n \"attestation_name\": \"<string>\",\r\n \"sonar_results\": {\r\n \"analysedAt\": \"<string>\",\r\n \"revision\": \"<string>\",\r\n \"project\": {\r\n \"key\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"name\": \"\"\r\n },\r\n \"serverUrl\": \"<string>\",\r\n \"taskId\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"changedAt\": \"<string>\",\r\n \"qualityGate\": {\r\n \"status\": \"<string>\",\r\n \"conditions\": [\r\n {\r\n \"metric\": \"<string>\",\r\n \"errorThreshold\": \"<string>\",\r\n \"operator\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"value\": \"<string>\",\r\n \"onLeakPeriod\": true\r\n }\r\n ],\r\n \"name\": \"<string>\"\r\n }\r\n },\r\n \"origin_url\": \"<string>\",\r\n \"description\": \"<string>\",\r\n \"artifact_fingerprint\": \"<string>\",\r\n \"target_artifacts\": [\r\n \"<string>\"\r\n ],\r\n \"git_commit_info\": {\r\n \"sha1\": \"<string>\",\r\n \"message\": \"<string>\",\r\n \"author\": \"<string>\",\r\n \"author_username\": \"<string>\",\r\n \"branch\": \"<string>\",\r\n \"timestamp\": 123,\r\n \"url\": \"<string>\",\r\n \"parents\": [\r\n \"<string>\"\r\n ],\r\n \"verified\": true,\r\n \"signature_state\": \"<string>\"\r\n },\r\n \"repo_info\": {\r\n \"name\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"id\": \"<string>\",\r\n \"description\": \"<string>\"\r\n },\r\n \"external_urls\": {},\r\n \"annotations\": {},\r\n \"user_data\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "multipart/form-data"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const form = new FormData();
form.append('data_json', '{
"attestation_name": "<string>",
"sonar_results": {
"analysedAt": "<string>",
"revision": "<string>",
"project": {
"key": "<string>",
"url": "<string>",
"name": ""
},
"serverUrl": "<string>",
"taskId": "<string>",
"status": "<string>",
"changedAt": "<string>",
"qualityGate": {
"status": "<string>",
"conditions": [
{
"metric": "<string>",
"errorThreshold": "<string>",
"operator": "<string>",
"status": "<string>",
"value": "<string>",
"onLeakPeriod": true
}
],
"name": "<string>"
}
},
"origin_url": "<string>",
"description": "<string>",
"artifact_fingerprint": "<string>",
"target_artifacts": [
"<string>"
],
"git_commit_info": {
"sha1": "<string>",
"message": "<string>",
"author": "<string>",
"author_username": "<string>",
"branch": "<string>",
"timestamp": 123,
"url": "<string>",
"parents": [
"<string>"
],
"verified": true,
"signature_state": "<string>"
},
"repo_info": {
"name": "<string>",
"url": "<string>",
"id": "<string>",
"description": "<string>"
},
"external_urls": {},
"annotations": {},
"user_data": {}
}');
form.append('attachment_file', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/sonar', 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://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/sonar",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data_json\"\r\n\r\n{\r\n \"attestation_name\": \"<string>\",\r\n \"sonar_results\": {\r\n \"analysedAt\": \"<string>\",\r\n \"revision\": \"<string>\",\r\n \"project\": {\r\n \"key\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"name\": \"\"\r\n },\r\n \"serverUrl\": \"<string>\",\r\n \"taskId\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"changedAt\": \"<string>\",\r\n \"qualityGate\": {\r\n \"status\": \"<string>\",\r\n \"conditions\": [\r\n {\r\n \"metric\": \"<string>\",\r\n \"errorThreshold\": \"<string>\",\r\n \"operator\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"value\": \"<string>\",\r\n \"onLeakPeriod\": true\r\n }\r\n ],\r\n \"name\": \"<string>\"\r\n }\r\n },\r\n \"origin_url\": \"<string>\",\r\n \"description\": \"<string>\",\r\n \"artifact_fingerprint\": \"<string>\",\r\n \"target_artifacts\": [\r\n \"<string>\"\r\n ],\r\n \"git_commit_info\": {\r\n \"sha1\": \"<string>\",\r\n \"message\": \"<string>\",\r\n \"author\": \"<string>\",\r\n \"author_username\": \"<string>\",\r\n \"branch\": \"<string>\",\r\n \"timestamp\": 123,\r\n \"url\": \"<string>\",\r\n \"parents\": [\r\n \"<string>\"\r\n ],\r\n \"verified\": true,\r\n \"signature_state\": \"<string>\"\r\n },\r\n \"repo_info\": {\r\n \"name\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"id\": \"<string>\",\r\n \"description\": \"<string>\"\r\n },\r\n \"external_urls\": {},\r\n \"annotations\": {},\r\n \"user_data\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/sonar"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data_json\"\r\n\r\n{\r\n \"attestation_name\": \"<string>\",\r\n \"sonar_results\": {\r\n \"analysedAt\": \"<string>\",\r\n \"revision\": \"<string>\",\r\n \"project\": {\r\n \"key\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"name\": \"\"\r\n },\r\n \"serverUrl\": \"<string>\",\r\n \"taskId\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"changedAt\": \"<string>\",\r\n \"qualityGate\": {\r\n \"status\": \"<string>\",\r\n \"conditions\": [\r\n {\r\n \"metric\": \"<string>\",\r\n \"errorThreshold\": \"<string>\",\r\n \"operator\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"value\": \"<string>\",\r\n \"onLeakPeriod\": true\r\n }\r\n ],\r\n \"name\": \"<string>\"\r\n }\r\n },\r\n \"origin_url\": \"<string>\",\r\n \"description\": \"<string>\",\r\n \"artifact_fingerprint\": \"<string>\",\r\n \"target_artifacts\": [\r\n \"<string>\"\r\n ],\r\n \"git_commit_info\": {\r\n \"sha1\": \"<string>\",\r\n \"message\": \"<string>\",\r\n \"author\": \"<string>\",\r\n \"author_username\": \"<string>\",\r\n \"branch\": \"<string>\",\r\n \"timestamp\": 123,\r\n \"url\": \"<string>\",\r\n \"parents\": [\r\n \"<string>\"\r\n ],\r\n \"verified\": true,\r\n \"signature_state\": \"<string>\"\r\n },\r\n \"repo_info\": {\r\n \"name\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"id\": \"<string>\",\r\n \"description\": \"<string>\"\r\n },\r\n \"external_urls\": {},\r\n \"annotations\": {},\r\n \"user_data\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/sonar")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data_json\"\r\n\r\n{\r\n \"attestation_name\": \"<string>\",\r\n \"sonar_results\": {\r\n \"analysedAt\": \"<string>\",\r\n \"revision\": \"<string>\",\r\n \"project\": {\r\n \"key\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"name\": \"\"\r\n },\r\n \"serverUrl\": \"<string>\",\r\n \"taskId\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"changedAt\": \"<string>\",\r\n \"qualityGate\": {\r\n \"status\": \"<string>\",\r\n \"conditions\": [\r\n {\r\n \"metric\": \"<string>\",\r\n \"errorThreshold\": \"<string>\",\r\n \"operator\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"value\": \"<string>\",\r\n \"onLeakPeriod\": true\r\n }\r\n ],\r\n \"name\": \"<string>\"\r\n }\r\n },\r\n \"origin_url\": \"<string>\",\r\n \"description\": \"<string>\",\r\n \"artifact_fingerprint\": \"<string>\",\r\n \"target_artifacts\": [\r\n \"<string>\"\r\n ],\r\n \"git_commit_info\": {\r\n \"sha1\": \"<string>\",\r\n \"message\": \"<string>\",\r\n \"author\": \"<string>\",\r\n \"author_username\": \"<string>\",\r\n \"branch\": \"<string>\",\r\n \"timestamp\": 123,\r\n \"url\": \"<string>\",\r\n \"parents\": [\r\n \"<string>\"\r\n ],\r\n \"verified\": true,\r\n \"signature_state\": \"<string>\"\r\n },\r\n \"repo_info\": {\r\n \"name\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"id\": \"<string>\",\r\n \"description\": \"<string>\"\r\n },\r\n \"external_urls\": {},\r\n \"annotations\": {},\r\n \"user_data\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/sonar")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data_json\"\r\n\r\n{\r\n \"attestation_name\": \"<string>\",\r\n \"sonar_results\": {\r\n \"analysedAt\": \"<string>\",\r\n \"revision\": \"<string>\",\r\n \"project\": {\r\n \"key\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"name\": \"\"\r\n },\r\n \"serverUrl\": \"<string>\",\r\n \"taskId\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"changedAt\": \"<string>\",\r\n \"qualityGate\": {\r\n \"status\": \"<string>\",\r\n \"conditions\": [\r\n {\r\n \"metric\": \"<string>\",\r\n \"errorThreshold\": \"<string>\",\r\n \"operator\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"value\": \"<string>\",\r\n \"onLeakPeriod\": true\r\n }\r\n ],\r\n \"name\": \"<string>\"\r\n }\r\n },\r\n \"origin_url\": \"<string>\",\r\n \"description\": \"<string>\",\r\n \"artifact_fingerprint\": \"<string>\",\r\n \"target_artifacts\": [\r\n \"<string>\"\r\n ],\r\n \"git_commit_info\": {\r\n \"sha1\": \"<string>\",\r\n \"message\": \"<string>\",\r\n \"author\": \"<string>\",\r\n \"author_username\": \"<string>\",\r\n \"branch\": \"<string>\",\r\n \"timestamp\": 123,\r\n \"url\": \"<string>\",\r\n \"parents\": [\r\n \"<string>\"\r\n ],\r\n \"verified\": true,\r\n \"signature_state\": \"<string>\"\r\n },\r\n \"repo_info\": {\r\n \"name\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"id\": \"<string>\",\r\n \"description\": \"<string>\"\r\n },\r\n \"external_urls\": {},\r\n \"annotations\": {},\r\n \"user_data\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body"<string>"Attest Sonar scan
Add Sonar attestation to a trail with an optional attachment file.
POST
/
attestations
/
{org}
/
{flow_name}
/
trail
/
{trail_name}
/
sonar
Attest Sonar scan
curl --request POST \
--url https://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/sonar \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'data_json={
"attestation_name": "<string>",
"sonar_results": {
"analysedAt": "<string>",
"revision": "<string>",
"project": {
"key": "<string>",
"url": "<string>",
"name": ""
},
"serverUrl": "<string>",
"taskId": "<string>",
"status": "<string>",
"changedAt": "<string>",
"qualityGate": {
"status": "<string>",
"conditions": [
{
"metric": "<string>",
"errorThreshold": "<string>",
"operator": "<string>",
"status": "<string>",
"value": "<string>",
"onLeakPeriod": true
}
],
"name": "<string>"
}
},
"origin_url": "<string>",
"description": "<string>",
"artifact_fingerprint": "<string>",
"target_artifacts": [
"<string>"
],
"git_commit_info": {
"sha1": "<string>",
"message": "<string>",
"author": "<string>",
"author_username": "<string>",
"branch": "<string>",
"timestamp": 123,
"url": "<string>",
"parents": [
"<string>"
],
"verified": true,
"signature_state": "<string>"
},
"repo_info": {
"name": "<string>",
"url": "<string>",
"id": "<string>",
"description": "<string>"
},
"external_urls": {},
"annotations": {},
"user_data": {}
}' \
--form 'attachment_file=<string>'import requests
url = "https://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/sonar"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data_json\"\r\n\r\n{\r\n \"attestation_name\": \"<string>\",\r\n \"sonar_results\": {\r\n \"analysedAt\": \"<string>\",\r\n \"revision\": \"<string>\",\r\n \"project\": {\r\n \"key\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"name\": \"\"\r\n },\r\n \"serverUrl\": \"<string>\",\r\n \"taskId\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"changedAt\": \"<string>\",\r\n \"qualityGate\": {\r\n \"status\": \"<string>\",\r\n \"conditions\": [\r\n {\r\n \"metric\": \"<string>\",\r\n \"errorThreshold\": \"<string>\",\r\n \"operator\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"value\": \"<string>\",\r\n \"onLeakPeriod\": true\r\n }\r\n ],\r\n \"name\": \"<string>\"\r\n }\r\n },\r\n \"origin_url\": \"<string>\",\r\n \"description\": \"<string>\",\r\n \"artifact_fingerprint\": \"<string>\",\r\n \"target_artifacts\": [\r\n \"<string>\"\r\n ],\r\n \"git_commit_info\": {\r\n \"sha1\": \"<string>\",\r\n \"message\": \"<string>\",\r\n \"author\": \"<string>\",\r\n \"author_username\": \"<string>\",\r\n \"branch\": \"<string>\",\r\n \"timestamp\": 123,\r\n \"url\": \"<string>\",\r\n \"parents\": [\r\n \"<string>\"\r\n ],\r\n \"verified\": true,\r\n \"signature_state\": \"<string>\"\r\n },\r\n \"repo_info\": {\r\n \"name\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"id\": \"<string>\",\r\n \"description\": \"<string>\"\r\n },\r\n \"external_urls\": {},\r\n \"annotations\": {},\r\n \"user_data\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "multipart/form-data"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const form = new FormData();
form.append('data_json', '{
"attestation_name": "<string>",
"sonar_results": {
"analysedAt": "<string>",
"revision": "<string>",
"project": {
"key": "<string>",
"url": "<string>",
"name": ""
},
"serverUrl": "<string>",
"taskId": "<string>",
"status": "<string>",
"changedAt": "<string>",
"qualityGate": {
"status": "<string>",
"conditions": [
{
"metric": "<string>",
"errorThreshold": "<string>",
"operator": "<string>",
"status": "<string>",
"value": "<string>",
"onLeakPeriod": true
}
],
"name": "<string>"
}
},
"origin_url": "<string>",
"description": "<string>",
"artifact_fingerprint": "<string>",
"target_artifacts": [
"<string>"
],
"git_commit_info": {
"sha1": "<string>",
"message": "<string>",
"author": "<string>",
"author_username": "<string>",
"branch": "<string>",
"timestamp": 123,
"url": "<string>",
"parents": [
"<string>"
],
"verified": true,
"signature_state": "<string>"
},
"repo_info": {
"name": "<string>",
"url": "<string>",
"id": "<string>",
"description": "<string>"
},
"external_urls": {},
"annotations": {},
"user_data": {}
}');
form.append('attachment_file', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/sonar', 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://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/sonar",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data_json\"\r\n\r\n{\r\n \"attestation_name\": \"<string>\",\r\n \"sonar_results\": {\r\n \"analysedAt\": \"<string>\",\r\n \"revision\": \"<string>\",\r\n \"project\": {\r\n \"key\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"name\": \"\"\r\n },\r\n \"serverUrl\": \"<string>\",\r\n \"taskId\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"changedAt\": \"<string>\",\r\n \"qualityGate\": {\r\n \"status\": \"<string>\",\r\n \"conditions\": [\r\n {\r\n \"metric\": \"<string>\",\r\n \"errorThreshold\": \"<string>\",\r\n \"operator\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"value\": \"<string>\",\r\n \"onLeakPeriod\": true\r\n }\r\n ],\r\n \"name\": \"<string>\"\r\n }\r\n },\r\n \"origin_url\": \"<string>\",\r\n \"description\": \"<string>\",\r\n \"artifact_fingerprint\": \"<string>\",\r\n \"target_artifacts\": [\r\n \"<string>\"\r\n ],\r\n \"git_commit_info\": {\r\n \"sha1\": \"<string>\",\r\n \"message\": \"<string>\",\r\n \"author\": \"<string>\",\r\n \"author_username\": \"<string>\",\r\n \"branch\": \"<string>\",\r\n \"timestamp\": 123,\r\n \"url\": \"<string>\",\r\n \"parents\": [\r\n \"<string>\"\r\n ],\r\n \"verified\": true,\r\n \"signature_state\": \"<string>\"\r\n },\r\n \"repo_info\": {\r\n \"name\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"id\": \"<string>\",\r\n \"description\": \"<string>\"\r\n },\r\n \"external_urls\": {},\r\n \"annotations\": {},\r\n \"user_data\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/sonar"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data_json\"\r\n\r\n{\r\n \"attestation_name\": \"<string>\",\r\n \"sonar_results\": {\r\n \"analysedAt\": \"<string>\",\r\n \"revision\": \"<string>\",\r\n \"project\": {\r\n \"key\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"name\": \"\"\r\n },\r\n \"serverUrl\": \"<string>\",\r\n \"taskId\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"changedAt\": \"<string>\",\r\n \"qualityGate\": {\r\n \"status\": \"<string>\",\r\n \"conditions\": [\r\n {\r\n \"metric\": \"<string>\",\r\n \"errorThreshold\": \"<string>\",\r\n \"operator\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"value\": \"<string>\",\r\n \"onLeakPeriod\": true\r\n }\r\n ],\r\n \"name\": \"<string>\"\r\n }\r\n },\r\n \"origin_url\": \"<string>\",\r\n \"description\": \"<string>\",\r\n \"artifact_fingerprint\": \"<string>\",\r\n \"target_artifacts\": [\r\n \"<string>\"\r\n ],\r\n \"git_commit_info\": {\r\n \"sha1\": \"<string>\",\r\n \"message\": \"<string>\",\r\n \"author\": \"<string>\",\r\n \"author_username\": \"<string>\",\r\n \"branch\": \"<string>\",\r\n \"timestamp\": 123,\r\n \"url\": \"<string>\",\r\n \"parents\": [\r\n \"<string>\"\r\n ],\r\n \"verified\": true,\r\n \"signature_state\": \"<string>\"\r\n },\r\n \"repo_info\": {\r\n \"name\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"id\": \"<string>\",\r\n \"description\": \"<string>\"\r\n },\r\n \"external_urls\": {},\r\n \"annotations\": {},\r\n \"user_data\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/sonar")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data_json\"\r\n\r\n{\r\n \"attestation_name\": \"<string>\",\r\n \"sonar_results\": {\r\n \"analysedAt\": \"<string>\",\r\n \"revision\": \"<string>\",\r\n \"project\": {\r\n \"key\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"name\": \"\"\r\n },\r\n \"serverUrl\": \"<string>\",\r\n \"taskId\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"changedAt\": \"<string>\",\r\n \"qualityGate\": {\r\n \"status\": \"<string>\",\r\n \"conditions\": [\r\n {\r\n \"metric\": \"<string>\",\r\n \"errorThreshold\": \"<string>\",\r\n \"operator\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"value\": \"<string>\",\r\n \"onLeakPeriod\": true\r\n }\r\n ],\r\n \"name\": \"<string>\"\r\n }\r\n },\r\n \"origin_url\": \"<string>\",\r\n \"description\": \"<string>\",\r\n \"artifact_fingerprint\": \"<string>\",\r\n \"target_artifacts\": [\r\n \"<string>\"\r\n ],\r\n \"git_commit_info\": {\r\n \"sha1\": \"<string>\",\r\n \"message\": \"<string>\",\r\n \"author\": \"<string>\",\r\n \"author_username\": \"<string>\",\r\n \"branch\": \"<string>\",\r\n \"timestamp\": 123,\r\n \"url\": \"<string>\",\r\n \"parents\": [\r\n \"<string>\"\r\n ],\r\n \"verified\": true,\r\n \"signature_state\": \"<string>\"\r\n },\r\n \"repo_info\": {\r\n \"name\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"id\": \"<string>\",\r\n \"description\": \"<string>\"\r\n },\r\n \"external_urls\": {},\r\n \"annotations\": {},\r\n \"user_data\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/sonar")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data_json\"\r\n\r\n{\r\n \"attestation_name\": \"<string>\",\r\n \"sonar_results\": {\r\n \"analysedAt\": \"<string>\",\r\n \"revision\": \"<string>\",\r\n \"project\": {\r\n \"key\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"name\": \"\"\r\n },\r\n \"serverUrl\": \"<string>\",\r\n \"taskId\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"changedAt\": \"<string>\",\r\n \"qualityGate\": {\r\n \"status\": \"<string>\",\r\n \"conditions\": [\r\n {\r\n \"metric\": \"<string>\",\r\n \"errorThreshold\": \"<string>\",\r\n \"operator\": \"<string>\",\r\n \"status\": \"<string>\",\r\n \"value\": \"<string>\",\r\n \"onLeakPeriod\": true\r\n }\r\n ],\r\n \"name\": \"<string>\"\r\n }\r\n },\r\n \"origin_url\": \"<string>\",\r\n \"description\": \"<string>\",\r\n \"artifact_fingerprint\": \"<string>\",\r\n \"target_artifacts\": [\r\n \"<string>\"\r\n ],\r\n \"git_commit_info\": {\r\n \"sha1\": \"<string>\",\r\n \"message\": \"<string>\",\r\n \"author\": \"<string>\",\r\n \"author_username\": \"<string>\",\r\n \"branch\": \"<string>\",\r\n \"timestamp\": 123,\r\n \"url\": \"<string>\",\r\n \"parents\": [\r\n \"<string>\"\r\n ],\r\n \"verified\": true,\r\n \"signature_state\": \"<string>\"\r\n },\r\n \"repo_info\": {\r\n \"name\": \"<string>\",\r\n \"url\": \"<string>\",\r\n \"id\": \"<string>\",\r\n \"description\": \"<string>\"\r\n },\r\n \"external_urls\": {},\r\n \"annotations\": {},\r\n \"user_data\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body"<string>"Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
multipart/form-data
Attestation data in JSON format
Show child attributes
Show child attributes
Example:
{ "attestation_name": "sonar", "git_commit_info": { "author": "Jon Smith <jon@smith.com>", "branch": "main", "message": "adding glorious commit", "sha1": "ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6", "timestamp": 1750923680, "url": "https://github.com/org/repo/commit/ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6" }, "sonar_results": { "analysedAt": "1724052982", "project": { "key": "xxx", "name": "", "url": "https://foo.com" }, "qualityGate": { "conditions": [ { "errorThreshold": "xx", "metric": "xx", "operator": "xx", "status": "OK" } ], "name": "gate-1", "status": "OK" }, "revision": "649a645f2c138b7c626f2d9a33b4f3baaad1e213" }, "user_data": {} }
Optional attachment file (max size: 10MB)
Response
Creation Success
The response is of type string.
Last modified on June 18, 2026
⌘I