Get snapshot
curl --request GET \
--url https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression} \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}', 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/snapshots/{org}/{env_name}/{snapshot_expression}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}"
req, _ := http.NewRequest("GET", url, nil)
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.get("https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"index": 123,
"is_latest": true,
"artifact_compliance_count": {},
"timestamp": 123,
"type": "<string>",
"compliant": true,
"html_url": "<string>",
"artifacts": [
{
"name": "<string>",
"fingerprint": "<string>",
"creationTimestamp": [
123
],
"annotation": {},
"flow_name": "<string>",
"git_commit": "<string>",
"commit_url": "<string>",
"html_url": "<string>",
"flow_html_url": "<string>",
"flows": [
{
"flow_name": "<string>",
"git_commit": "<string>",
"commit_url": "<string>",
"html_url": "<string>",
"flow_html_url": "<string>",
"trail_name": "<string>",
"template_reference_name": "<string>",
"git_commit_info": {},
"deployment_diff": {
"diff_url": "<string>",
"previous_git_commit": "<string>",
"previous_git_commit_url": "<string>",
"previous_fingerprint": "<string>",
"previous_artifact_name": "<string>",
"previous_artifact_compliance_state": "<string>",
"previous_running": true,
"previous_trail_name": "<string>",
"previous_template_reference_name": "<string>"
},
"commit_lead_time": 123,
"artifact_compliance_in_flow": true,
"flow_reasons_for_non_compliance": [
{}
]
}
],
"compliant": true,
"deployments": [
123
],
"policy_decisions": [
{
"policy_version": 123,
"status": "COMPLIANT",
"policy_name": "<string>",
"rule_evaluations": []
}
],
"reasons_for_incompliance": [
{}
],
"pods": {},
"deployment_diff": {
"diff_url": "<string>",
"previous_git_commit": "<string>",
"previous_git_commit_url": "<string>",
"previous_fingerprint": "<string>",
"previous_artifact_name": "<string>",
"previous_artifact_compliance_state": "<string>",
"previous_running": true,
"previous_trail_name": "<string>",
"previous_template_reference_name": "<string>"
},
"commit_lead_time": 123,
"ecs_context": {
"task_arn": "<string>",
"cluster_name": "<string>",
"service_name": "<string>"
},
"cloud_run_context": {
"kind": "<string>",
"revision_name": "<string>",
"service_name": "<string>",
"job_name": "<string>"
}
}
],
"applied_policies": [
{}
],
"next_snapshot_timestamp": 123
}Get snapshot
Get a snapshot for an environment.
`snapshot_expression` can be specified as follows:
- `N`: the Nth snapshot, counting from 1. Negative values count from the latest snapshot i.e. -1 is the latest snapshot.
example: 42
- `~N`: the Nth snapshot behind the latest, at the time of the request
example: ~5
- `@{YYYY-MM-DDTHH:MM:SS}`: the snapshot at specific moment in time in UTC
example: @{2023-10-02T12:00:00}
- `@{N.<hours|days|weeks|months>.ago}`: the snapshot at a time relative to the time of the request. N is a positive integer.
example: @{2.hours.ago}
- `@{now}`: the snapshot at the time of the request
example: @{now}
GET
/
snapshots
/
{org}
/
{env_name}
/
{snapshot_expression}
Get snapshot
curl --request GET \
--url https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression} \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}', 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/snapshots/{org}/{env_name}/{snapshot_expression}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}"
req, _ := http.NewRequest("GET", url, nil)
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.get("https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"index": 123,
"is_latest": true,
"artifact_compliance_count": {},
"timestamp": 123,
"type": "<string>",
"compliant": true,
"html_url": "<string>",
"artifacts": [
{
"name": "<string>",
"fingerprint": "<string>",
"creationTimestamp": [
123
],
"annotation": {},
"flow_name": "<string>",
"git_commit": "<string>",
"commit_url": "<string>",
"html_url": "<string>",
"flow_html_url": "<string>",
"flows": [
{
"flow_name": "<string>",
"git_commit": "<string>",
"commit_url": "<string>",
"html_url": "<string>",
"flow_html_url": "<string>",
"trail_name": "<string>",
"template_reference_name": "<string>",
"git_commit_info": {},
"deployment_diff": {
"diff_url": "<string>",
"previous_git_commit": "<string>",
"previous_git_commit_url": "<string>",
"previous_fingerprint": "<string>",
"previous_artifact_name": "<string>",
"previous_artifact_compliance_state": "<string>",
"previous_running": true,
"previous_trail_name": "<string>",
"previous_template_reference_name": "<string>"
},
"commit_lead_time": 123,
"artifact_compliance_in_flow": true,
"flow_reasons_for_non_compliance": [
{}
]
}
],
"compliant": true,
"deployments": [
123
],
"policy_decisions": [
{
"policy_version": 123,
"status": "COMPLIANT",
"policy_name": "<string>",
"rule_evaluations": []
}
],
"reasons_for_incompliance": [
{}
],
"pods": {},
"deployment_diff": {
"diff_url": "<string>",
"previous_git_commit": "<string>",
"previous_git_commit_url": "<string>",
"previous_fingerprint": "<string>",
"previous_artifact_name": "<string>",
"previous_artifact_compliance_state": "<string>",
"previous_running": true,
"previous_trail_name": "<string>",
"previous_template_reference_name": "<string>"
},
"commit_lead_time": 123,
"ecs_context": {
"task_arn": "<string>",
"cluster_name": "<string>",
"service_name": "<string>"
},
"cloud_run_context": {
"kind": "<string>",
"revision_name": "<string>",
"service_name": "<string>",
"job_name": "<string>"
}
}
],
"applied_policies": [
{}
],
"next_snapshot_timestamp": 123
}Authorizations
Path Parameters
Response
200 - application/json
Successful Response