Attest pull request
curl --request POST \
--url https://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/pull_request \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'data_json={
"attestation_name": "pr",
"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"
},
"git_provider": "github",
"pull_requests": [
{
"approvers": [
{
"author": "Jon Doe",
"state": "APPROVED",
"timestamp": 1750923266
}
],
"author": "JonSmith",
"commits": [
{
"author": "Jon Smith <jon@smith.com>",
"author_username": "JonSmith",
"branch": "glorious-branch",
"message": "Add glorious feature",
"sha": "f387a894992f7991489680696abf8b72bf7875f1",
"timestamp": 1750851568,
"url": "https://github.com/org/repo/commit/f387a894992f7991489680696abf8b72bf7875f1"
},
{
"author": "Jon Smith <jon@smith.com>",
"author_username": "JonSmith",
"branch": "glorious-branch",
"message": "Update glorious feature",
"sha": "2d48854228633cca94f7f4a587b2172ebb01cf85",
"timestamp": 1750922905
}
],
"created_at": 1750851601,
"head_ref": "glorious-branch",
"merge_commit": "ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6",
"merged_at": 1750923680,
"state": "MERGED",
"title": "Add glorious commit",
"url": "https://github.com/org/repo/pull/3497"
}
],
"user_data": {}
}' \
--form 'attachment_file=<string>' \
--form attachment_file.0='@example-file'import requests
url = "https://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/pull_request"
files = { "attachment_file.0": ("example-file", open("example-file", "rb")) }
payload = {
"data_json": "{
\"attestation_name\": \"pr\",
\"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\"
},
\"git_provider\": \"github\",
\"pull_requests\": [
{
\"approvers\": [
{
\"author\": \"Jon Doe\",
\"state\": \"APPROVED\",
\"timestamp\": 1750923266
}
],
\"author\": \"JonSmith\",
\"commits\": [
{
\"author\": \"Jon Smith <jon@smith.com>\",
\"author_username\": \"JonSmith\",
\"branch\": \"glorious-branch\",
\"message\": \"Add glorious feature\",
\"sha\": \"f387a894992f7991489680696abf8b72bf7875f1\",
\"timestamp\": 1750851568,
\"url\": \"https://github.com/org/repo/commit/f387a894992f7991489680696abf8b72bf7875f1\"
},
{
\"author\": \"Jon Smith <jon@smith.com>\",
\"author_username\": \"JonSmith\",
\"branch\": \"glorious-branch\",
\"message\": \"Update glorious feature\",
\"sha\": \"2d48854228633cca94f7f4a587b2172ebb01cf85\",
\"timestamp\": 1750922905
}
],
\"created_at\": 1750851601,
\"head_ref\": \"glorious-branch\",
\"merge_commit\": \"ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\",
\"merged_at\": 1750923680,
\"state\": \"MERGED\",
\"title\": \"Add glorious commit\",
\"url\": \"https://github.com/org/repo/pull/3497\"
}
],
\"user_data\": {}
}",
"attachment_file": "<string>"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('data_json', '{
"attestation_name": "pr",
"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"
},
"git_provider": "github",
"pull_requests": [
{
"approvers": [
{
"author": "Jon Doe",
"state": "APPROVED",
"timestamp": 1750923266
}
],
"author": "JonSmith",
"commits": [
{
"author": "Jon Smith <jon@smith.com>",
"author_username": "JonSmith",
"branch": "glorious-branch",
"message": "Add glorious feature",
"sha": "f387a894992f7991489680696abf8b72bf7875f1",
"timestamp": 1750851568,
"url": "https://github.com/org/repo/commit/f387a894992f7991489680696abf8b72bf7875f1"
},
{
"author": "Jon Smith <jon@smith.com>",
"author_username": "JonSmith",
"branch": "glorious-branch",
"message": "Update glorious feature",
"sha": "2d48854228633cca94f7f4a587b2172ebb01cf85",
"timestamp": 1750922905
}
],
"created_at": 1750851601,
"head_ref": "glorious-branch",
"merge_commit": "ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6",
"merged_at": 1750923680,
"state": "MERGED",
"title": "Add glorious commit",
"url": "https://github.com/org/repo/pull/3497"
}
],
"user_data": {}
}');
form.append('attachment_file', '<string>');
form.append('attachment_file.0', '{
"fileName": "example-file"
}');
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}/pull_request', 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}/pull_request",
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\": \"pr\",\r\n \"git_commit_info\": {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"branch\": \"main\",\r\n \"message\": \"adding glorious commit\",\r\n \"sha1\": \"ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\",\r\n \"timestamp\": 1750923680,\r\n \"url\": \"https://github.com/org/repo/commit/ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\"\r\n },\r\n \"git_provider\": \"github\",\r\n \"pull_requests\": [\r\n {\r\n \"approvers\": [\r\n {\r\n \"author\": \"Jon Doe\",\r\n \"state\": \"APPROVED\",\r\n \"timestamp\": 1750923266\r\n }\r\n ],\r\n \"author\": \"JonSmith\",\r\n \"commits\": [\r\n {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"author_username\": \"JonSmith\",\r\n \"branch\": \"glorious-branch\",\r\n \"message\": \"Add glorious feature\",\r\n \"sha\": \"f387a894992f7991489680696abf8b72bf7875f1\",\r\n \"timestamp\": 1750851568,\r\n \"url\": \"https://github.com/org/repo/commit/f387a894992f7991489680696abf8b72bf7875f1\"\r\n },\r\n {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"author_username\": \"JonSmith\",\r\n \"branch\": \"glorious-branch\",\r\n \"message\": \"Update glorious feature\",\r\n \"sha\": \"2d48854228633cca94f7f4a587b2172ebb01cf85\",\r\n \"timestamp\": 1750922905\r\n }\r\n ],\r\n \"created_at\": 1750851601,\r\n \"head_ref\": \"glorious-branch\",\r\n \"merge_commit\": \"ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\",\r\n \"merged_at\": 1750923680,\r\n \"state\": \"MERGED\",\r\n \"title\": \"Add glorious commit\",\r\n \"url\": \"https://github.com/org/repo/pull/3497\"\r\n }\r\n ],\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\r\nContent-Disposition: form-data; name=\"attachment_file.0\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\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}/pull_request"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data_json\"\r\n\r\n{\r\n \"attestation_name\": \"pr\",\r\n \"git_commit_info\": {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"branch\": \"main\",\r\n \"message\": \"adding glorious commit\",\r\n \"sha1\": \"ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\",\r\n \"timestamp\": 1750923680,\r\n \"url\": \"https://github.com/org/repo/commit/ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\"\r\n },\r\n \"git_provider\": \"github\",\r\n \"pull_requests\": [\r\n {\r\n \"approvers\": [\r\n {\r\n \"author\": \"Jon Doe\",\r\n \"state\": \"APPROVED\",\r\n \"timestamp\": 1750923266\r\n }\r\n ],\r\n \"author\": \"JonSmith\",\r\n \"commits\": [\r\n {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"author_username\": \"JonSmith\",\r\n \"branch\": \"glorious-branch\",\r\n \"message\": \"Add glorious feature\",\r\n \"sha\": \"f387a894992f7991489680696abf8b72bf7875f1\",\r\n \"timestamp\": 1750851568,\r\n \"url\": \"https://github.com/org/repo/commit/f387a894992f7991489680696abf8b72bf7875f1\"\r\n },\r\n {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"author_username\": \"JonSmith\",\r\n \"branch\": \"glorious-branch\",\r\n \"message\": \"Update glorious feature\",\r\n \"sha\": \"2d48854228633cca94f7f4a587b2172ebb01cf85\",\r\n \"timestamp\": 1750922905\r\n }\r\n ],\r\n \"created_at\": 1750851601,\r\n \"head_ref\": \"glorious-branch\",\r\n \"merge_commit\": \"ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\",\r\n \"merged_at\": 1750923680,\r\n \"state\": \"MERGED\",\r\n \"title\": \"Add glorious commit\",\r\n \"url\": \"https://github.com/org/repo/pull/3497\"\r\n }\r\n ],\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\r\nContent-Disposition: form-data; name=\"attachment_file.0\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\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}/pull_request")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data_json\"\r\n\r\n{\r\n \"attestation_name\": \"pr\",\r\n \"git_commit_info\": {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"branch\": \"main\",\r\n \"message\": \"adding glorious commit\",\r\n \"sha1\": \"ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\",\r\n \"timestamp\": 1750923680,\r\n \"url\": \"https://github.com/org/repo/commit/ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\"\r\n },\r\n \"git_provider\": \"github\",\r\n \"pull_requests\": [\r\n {\r\n \"approvers\": [\r\n {\r\n \"author\": \"Jon Doe\",\r\n \"state\": \"APPROVED\",\r\n \"timestamp\": 1750923266\r\n }\r\n ],\r\n \"author\": \"JonSmith\",\r\n \"commits\": [\r\n {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"author_username\": \"JonSmith\",\r\n \"branch\": \"glorious-branch\",\r\n \"message\": \"Add glorious feature\",\r\n \"sha\": \"f387a894992f7991489680696abf8b72bf7875f1\",\r\n \"timestamp\": 1750851568,\r\n \"url\": \"https://github.com/org/repo/commit/f387a894992f7991489680696abf8b72bf7875f1\"\r\n },\r\n {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"author_username\": \"JonSmith\",\r\n \"branch\": \"glorious-branch\",\r\n \"message\": \"Update glorious feature\",\r\n \"sha\": \"2d48854228633cca94f7f4a587b2172ebb01cf85\",\r\n \"timestamp\": 1750922905\r\n }\r\n ],\r\n \"created_at\": 1750851601,\r\n \"head_ref\": \"glorious-branch\",\r\n \"merge_commit\": \"ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\",\r\n \"merged_at\": 1750923680,\r\n \"state\": \"MERGED\",\r\n \"title\": \"Add glorious commit\",\r\n \"url\": \"https://github.com/org/repo/pull/3497\"\r\n }\r\n ],\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\r\nContent-Disposition: form-data; name=\"attachment_file.0\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/pull_request")
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\": \"pr\",\r\n \"git_commit_info\": {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"branch\": \"main\",\r\n \"message\": \"adding glorious commit\",\r\n \"sha1\": \"ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\",\r\n \"timestamp\": 1750923680,\r\n \"url\": \"https://github.com/org/repo/commit/ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\"\r\n },\r\n \"git_provider\": \"github\",\r\n \"pull_requests\": [\r\n {\r\n \"approvers\": [\r\n {\r\n \"author\": \"Jon Doe\",\r\n \"state\": \"APPROVED\",\r\n \"timestamp\": 1750923266\r\n }\r\n ],\r\n \"author\": \"JonSmith\",\r\n \"commits\": [\r\n {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"author_username\": \"JonSmith\",\r\n \"branch\": \"glorious-branch\",\r\n \"message\": \"Add glorious feature\",\r\n \"sha\": \"f387a894992f7991489680696abf8b72bf7875f1\",\r\n \"timestamp\": 1750851568,\r\n \"url\": \"https://github.com/org/repo/commit/f387a894992f7991489680696abf8b72bf7875f1\"\r\n },\r\n {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"author_username\": \"JonSmith\",\r\n \"branch\": \"glorious-branch\",\r\n \"message\": \"Update glorious feature\",\r\n \"sha\": \"2d48854228633cca94f7f4a587b2172ebb01cf85\",\r\n \"timestamp\": 1750922905\r\n }\r\n ],\r\n \"created_at\": 1750851601,\r\n \"head_ref\": \"glorious-branch\",\r\n \"merge_commit\": \"ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\",\r\n \"merged_at\": 1750923680,\r\n \"state\": \"MERGED\",\r\n \"title\": \"Add glorious commit\",\r\n \"url\": \"https://github.com/org/repo/pull/3497\"\r\n }\r\n ],\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\r\nContent-Disposition: form-data; name=\"attachment_file.0\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body"<string>"Attest pull request
Add Pull-Request attestation to a trail with an optional attachment file.
POST
/
attestations
/
{org}
/
{flow_name}
/
trail
/
{trail_name}
/
pull_request
Attest pull request
curl --request POST \
--url https://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/pull_request \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'data_json={
"attestation_name": "pr",
"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"
},
"git_provider": "github",
"pull_requests": [
{
"approvers": [
{
"author": "Jon Doe",
"state": "APPROVED",
"timestamp": 1750923266
}
],
"author": "JonSmith",
"commits": [
{
"author": "Jon Smith <jon@smith.com>",
"author_username": "JonSmith",
"branch": "glorious-branch",
"message": "Add glorious feature",
"sha": "f387a894992f7991489680696abf8b72bf7875f1",
"timestamp": 1750851568,
"url": "https://github.com/org/repo/commit/f387a894992f7991489680696abf8b72bf7875f1"
},
{
"author": "Jon Smith <jon@smith.com>",
"author_username": "JonSmith",
"branch": "glorious-branch",
"message": "Update glorious feature",
"sha": "2d48854228633cca94f7f4a587b2172ebb01cf85",
"timestamp": 1750922905
}
],
"created_at": 1750851601,
"head_ref": "glorious-branch",
"merge_commit": "ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6",
"merged_at": 1750923680,
"state": "MERGED",
"title": "Add glorious commit",
"url": "https://github.com/org/repo/pull/3497"
}
],
"user_data": {}
}' \
--form 'attachment_file=<string>' \
--form attachment_file.0='@example-file'import requests
url = "https://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/pull_request"
files = { "attachment_file.0": ("example-file", open("example-file", "rb")) }
payload = {
"data_json": "{
\"attestation_name\": \"pr\",
\"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\"
},
\"git_provider\": \"github\",
\"pull_requests\": [
{
\"approvers\": [
{
\"author\": \"Jon Doe\",
\"state\": \"APPROVED\",
\"timestamp\": 1750923266
}
],
\"author\": \"JonSmith\",
\"commits\": [
{
\"author\": \"Jon Smith <jon@smith.com>\",
\"author_username\": \"JonSmith\",
\"branch\": \"glorious-branch\",
\"message\": \"Add glorious feature\",
\"sha\": \"f387a894992f7991489680696abf8b72bf7875f1\",
\"timestamp\": 1750851568,
\"url\": \"https://github.com/org/repo/commit/f387a894992f7991489680696abf8b72bf7875f1\"
},
{
\"author\": \"Jon Smith <jon@smith.com>\",
\"author_username\": \"JonSmith\",
\"branch\": \"glorious-branch\",
\"message\": \"Update glorious feature\",
\"sha\": \"2d48854228633cca94f7f4a587b2172ebb01cf85\",
\"timestamp\": 1750922905
}
],
\"created_at\": 1750851601,
\"head_ref\": \"glorious-branch\",
\"merge_commit\": \"ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\",
\"merged_at\": 1750923680,
\"state\": \"MERGED\",
\"title\": \"Add glorious commit\",
\"url\": \"https://github.com/org/repo/pull/3497\"
}
],
\"user_data\": {}
}",
"attachment_file": "<string>"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('data_json', '{
"attestation_name": "pr",
"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"
},
"git_provider": "github",
"pull_requests": [
{
"approvers": [
{
"author": "Jon Doe",
"state": "APPROVED",
"timestamp": 1750923266
}
],
"author": "JonSmith",
"commits": [
{
"author": "Jon Smith <jon@smith.com>",
"author_username": "JonSmith",
"branch": "glorious-branch",
"message": "Add glorious feature",
"sha": "f387a894992f7991489680696abf8b72bf7875f1",
"timestamp": 1750851568,
"url": "https://github.com/org/repo/commit/f387a894992f7991489680696abf8b72bf7875f1"
},
{
"author": "Jon Smith <jon@smith.com>",
"author_username": "JonSmith",
"branch": "glorious-branch",
"message": "Update glorious feature",
"sha": "2d48854228633cca94f7f4a587b2172ebb01cf85",
"timestamp": 1750922905
}
],
"created_at": 1750851601,
"head_ref": "glorious-branch",
"merge_commit": "ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6",
"merged_at": 1750923680,
"state": "MERGED",
"title": "Add glorious commit",
"url": "https://github.com/org/repo/pull/3497"
}
],
"user_data": {}
}');
form.append('attachment_file', '<string>');
form.append('attachment_file.0', '{
"fileName": "example-file"
}');
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}/pull_request', 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}/pull_request",
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\": \"pr\",\r\n \"git_commit_info\": {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"branch\": \"main\",\r\n \"message\": \"adding glorious commit\",\r\n \"sha1\": \"ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\",\r\n \"timestamp\": 1750923680,\r\n \"url\": \"https://github.com/org/repo/commit/ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\"\r\n },\r\n \"git_provider\": \"github\",\r\n \"pull_requests\": [\r\n {\r\n \"approvers\": [\r\n {\r\n \"author\": \"Jon Doe\",\r\n \"state\": \"APPROVED\",\r\n \"timestamp\": 1750923266\r\n }\r\n ],\r\n \"author\": \"JonSmith\",\r\n \"commits\": [\r\n {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"author_username\": \"JonSmith\",\r\n \"branch\": \"glorious-branch\",\r\n \"message\": \"Add glorious feature\",\r\n \"sha\": \"f387a894992f7991489680696abf8b72bf7875f1\",\r\n \"timestamp\": 1750851568,\r\n \"url\": \"https://github.com/org/repo/commit/f387a894992f7991489680696abf8b72bf7875f1\"\r\n },\r\n {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"author_username\": \"JonSmith\",\r\n \"branch\": \"glorious-branch\",\r\n \"message\": \"Update glorious feature\",\r\n \"sha\": \"2d48854228633cca94f7f4a587b2172ebb01cf85\",\r\n \"timestamp\": 1750922905\r\n }\r\n ],\r\n \"created_at\": 1750851601,\r\n \"head_ref\": \"glorious-branch\",\r\n \"merge_commit\": \"ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\",\r\n \"merged_at\": 1750923680,\r\n \"state\": \"MERGED\",\r\n \"title\": \"Add glorious commit\",\r\n \"url\": \"https://github.com/org/repo/pull/3497\"\r\n }\r\n ],\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\r\nContent-Disposition: form-data; name=\"attachment_file.0\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\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}/pull_request"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data_json\"\r\n\r\n{\r\n \"attestation_name\": \"pr\",\r\n \"git_commit_info\": {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"branch\": \"main\",\r\n \"message\": \"adding glorious commit\",\r\n \"sha1\": \"ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\",\r\n \"timestamp\": 1750923680,\r\n \"url\": \"https://github.com/org/repo/commit/ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\"\r\n },\r\n \"git_provider\": \"github\",\r\n \"pull_requests\": [\r\n {\r\n \"approvers\": [\r\n {\r\n \"author\": \"Jon Doe\",\r\n \"state\": \"APPROVED\",\r\n \"timestamp\": 1750923266\r\n }\r\n ],\r\n \"author\": \"JonSmith\",\r\n \"commits\": [\r\n {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"author_username\": \"JonSmith\",\r\n \"branch\": \"glorious-branch\",\r\n \"message\": \"Add glorious feature\",\r\n \"sha\": \"f387a894992f7991489680696abf8b72bf7875f1\",\r\n \"timestamp\": 1750851568,\r\n \"url\": \"https://github.com/org/repo/commit/f387a894992f7991489680696abf8b72bf7875f1\"\r\n },\r\n {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"author_username\": \"JonSmith\",\r\n \"branch\": \"glorious-branch\",\r\n \"message\": \"Update glorious feature\",\r\n \"sha\": \"2d48854228633cca94f7f4a587b2172ebb01cf85\",\r\n \"timestamp\": 1750922905\r\n }\r\n ],\r\n \"created_at\": 1750851601,\r\n \"head_ref\": \"glorious-branch\",\r\n \"merge_commit\": \"ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\",\r\n \"merged_at\": 1750923680,\r\n \"state\": \"MERGED\",\r\n \"title\": \"Add glorious commit\",\r\n \"url\": \"https://github.com/org/repo/pull/3497\"\r\n }\r\n ],\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\r\nContent-Disposition: form-data; name=\"attachment_file.0\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\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}/pull_request")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data_json\"\r\n\r\n{\r\n \"attestation_name\": \"pr\",\r\n \"git_commit_info\": {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"branch\": \"main\",\r\n \"message\": \"adding glorious commit\",\r\n \"sha1\": \"ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\",\r\n \"timestamp\": 1750923680,\r\n \"url\": \"https://github.com/org/repo/commit/ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\"\r\n },\r\n \"git_provider\": \"github\",\r\n \"pull_requests\": [\r\n {\r\n \"approvers\": [\r\n {\r\n \"author\": \"Jon Doe\",\r\n \"state\": \"APPROVED\",\r\n \"timestamp\": 1750923266\r\n }\r\n ],\r\n \"author\": \"JonSmith\",\r\n \"commits\": [\r\n {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"author_username\": \"JonSmith\",\r\n \"branch\": \"glorious-branch\",\r\n \"message\": \"Add glorious feature\",\r\n \"sha\": \"f387a894992f7991489680696abf8b72bf7875f1\",\r\n \"timestamp\": 1750851568,\r\n \"url\": \"https://github.com/org/repo/commit/f387a894992f7991489680696abf8b72bf7875f1\"\r\n },\r\n {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"author_username\": \"JonSmith\",\r\n \"branch\": \"glorious-branch\",\r\n \"message\": \"Update glorious feature\",\r\n \"sha\": \"2d48854228633cca94f7f4a587b2172ebb01cf85\",\r\n \"timestamp\": 1750922905\r\n }\r\n ],\r\n \"created_at\": 1750851601,\r\n \"head_ref\": \"glorious-branch\",\r\n \"merge_commit\": \"ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\",\r\n \"merged_at\": 1750923680,\r\n \"state\": \"MERGED\",\r\n \"title\": \"Add glorious commit\",\r\n \"url\": \"https://github.com/org/repo/pull/3497\"\r\n }\r\n ],\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\r\nContent-Disposition: form-data; name=\"attachment_file.0\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/pull_request")
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\": \"pr\",\r\n \"git_commit_info\": {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"branch\": \"main\",\r\n \"message\": \"adding glorious commit\",\r\n \"sha1\": \"ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\",\r\n \"timestamp\": 1750923680,\r\n \"url\": \"https://github.com/org/repo/commit/ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\"\r\n },\r\n \"git_provider\": \"github\",\r\n \"pull_requests\": [\r\n {\r\n \"approvers\": [\r\n {\r\n \"author\": \"Jon Doe\",\r\n \"state\": \"APPROVED\",\r\n \"timestamp\": 1750923266\r\n }\r\n ],\r\n \"author\": \"JonSmith\",\r\n \"commits\": [\r\n {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"author_username\": \"JonSmith\",\r\n \"branch\": \"glorious-branch\",\r\n \"message\": \"Add glorious feature\",\r\n \"sha\": \"f387a894992f7991489680696abf8b72bf7875f1\",\r\n \"timestamp\": 1750851568,\r\n \"url\": \"https://github.com/org/repo/commit/f387a894992f7991489680696abf8b72bf7875f1\"\r\n },\r\n {\r\n \"author\": \"Jon Smith <jon@smith.com>\",\r\n \"author_username\": \"JonSmith\",\r\n \"branch\": \"glorious-branch\",\r\n \"message\": \"Update glorious feature\",\r\n \"sha\": \"2d48854228633cca94f7f4a587b2172ebb01cf85\",\r\n \"timestamp\": 1750922905\r\n }\r\n ],\r\n \"created_at\": 1750851601,\r\n \"head_ref\": \"glorious-branch\",\r\n \"merge_commit\": \"ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6\",\r\n \"merged_at\": 1750923680,\r\n \"state\": \"MERGED\",\r\n \"title\": \"Add glorious commit\",\r\n \"url\": \"https://github.com/org/repo/pull/3497\"\r\n }\r\n ],\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\r\nContent-Disposition: form-data; name=\"attachment_file.0\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\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": "pr", "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" }, "git_provider": "github", "pull_requests": [ { "approvers": [ { "author": "Jon Doe", "state": "APPROVED", "timestamp": 1750923266 } ], "author": "JonSmith", "commits": [ { "author": "Jon Smith <jon@smith.com>", "author_username": "JonSmith", "branch": "glorious-branch", "message": "Add glorious feature", "sha": "f387a894992f7991489680696abf8b72bf7875f1", "timestamp": 1750851568, "url": "https://github.com/org/repo/commit/f387a894992f7991489680696abf8b72bf7875f1" }, { "author": "Jon Smith <jon@smith.com>", "author_username": "JonSmith", "branch": "glorious-branch", "message": "Update glorious feature", "sha": "2d48854228633cca94f7f4a587b2172ebb01cf85", "timestamp": 1750922905 } ], "created_at": 1750851601, "head_ref": "glorious-branch", "merge_commit": "ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6", "merged_at": 1750923680, "state": "MERGED", "title": "Add glorious commit", "url": "https://github.com/org/repo/pull/3497" } ], "user_data": {} }
Optional attachment file (max size: 10MB)
Response
Creation Success
The response is of type string.
Last modified on August 24, 2026
⌘I