Enable one named regulatory policy template set
curl --request POST \
--url https://{tenant}.earnie.dev/v1/projects/{projectId}/policy-template-sets/{setSlug}:enable \
--header 'Authorization: Bearer <token>'import requests
url = "https://{tenant}.earnie.dev/v1/projects/{projectId}/policy-template-sets/{setSlug}:enable"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{tenant}.earnie.dev/v1/projects/{projectId}/policy-template-sets/{setSlug}:enable', 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://{tenant}.earnie.dev/v1/projects/{projectId}/policy-template-sets/{setSlug}:enable",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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://{tenant}.earnie.dev/v1/projects/{projectId}/policy-template-sets/{setSlug}:enable"
req, _ := http.NewRequest("POST", 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.post("https://{tenant}.earnie.dev/v1/projects/{projectId}/policy-template-sets/{setSlug}:enable")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}.earnie.dev/v1/projects/{projectId}/policy-template-sets/{setSlug}:enable")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"set": {
"slug": "<string>",
"name": "<string>",
"clause": "<string>",
"members": [
{
"label": "<string>",
"template": {
"id": 123,
"slug": "<string>",
"source": "seed",
"module": "<string>",
"category": "<string>",
"name": "<string>",
"description": "<string>",
"agent_rule": "<string>",
"agent_rule_stale": true,
"enabled": true,
"action": "block",
"expression": "<string>",
"parameter_spec": [
{
"key": "<string>",
"label": "<string>",
"type": "string",
"options": [
"<string>"
],
"default": "<unknown>",
"constrains": "<string>"
}
],
"values": {},
"revision": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"result_summary": {
"state": "passed",
"violations_count": 1,
"affected_files_count": 1,
"affected_components_count": 1,
"missing_enrichments": [
"<string>"
],
"error_message": "<string>",
"last_evaluated_at": "2023-11-07T05:31:56Z"
}
}
}
]
},
"policies": [
{
"id": 123,
"slug": "<string>",
"source": "seed",
"module": "<string>",
"category": "<string>",
"name": "<string>",
"description": "<string>",
"agent_rule": "<string>",
"agent_rule_stale": true,
"enabled": true,
"action": "block",
"expression": "<string>",
"parameter_spec": [
{
"key": "<string>",
"label": "<string>",
"type": "string",
"options": [
"<string>"
],
"default": "<unknown>",
"constrains": "<string>"
}
],
"values": {},
"revision": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"result_summary": {
"state": "passed",
"violations_count": 1,
"affected_files_count": 1,
"affected_components_count": 1,
"missing_enrichments": [
"<string>"
],
"error_message": "<string>",
"last_evaluated_at": "2023-11-07T05:31:56Z"
}
}
]
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "no_fixture",
"module": "<string>"
}policies
Enable one named regulatory policy template set
Atomically materializes independent project policies for every fixed template in the named set. Repeated calls reuse and re-enable semantically equivalent project policies rather than creating duplicates.
POST
/
v1
/
projects
/
{projectId}
/
policy-template-sets
/
{setSlug}
:enable
Enable one named regulatory policy template set
curl --request POST \
--url https://{tenant}.earnie.dev/v1/projects/{projectId}/policy-template-sets/{setSlug}:enable \
--header 'Authorization: Bearer <token>'import requests
url = "https://{tenant}.earnie.dev/v1/projects/{projectId}/policy-template-sets/{setSlug}:enable"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{tenant}.earnie.dev/v1/projects/{projectId}/policy-template-sets/{setSlug}:enable', 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://{tenant}.earnie.dev/v1/projects/{projectId}/policy-template-sets/{setSlug}:enable",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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://{tenant}.earnie.dev/v1/projects/{projectId}/policy-template-sets/{setSlug}:enable"
req, _ := http.NewRequest("POST", 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.post("https://{tenant}.earnie.dev/v1/projects/{projectId}/policy-template-sets/{setSlug}:enable")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}.earnie.dev/v1/projects/{projectId}/policy-template-sets/{setSlug}:enable")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"set": {
"slug": "<string>",
"name": "<string>",
"clause": "<string>",
"members": [
{
"label": "<string>",
"template": {
"id": 123,
"slug": "<string>",
"source": "seed",
"module": "<string>",
"category": "<string>",
"name": "<string>",
"description": "<string>",
"agent_rule": "<string>",
"agent_rule_stale": true,
"enabled": true,
"action": "block",
"expression": "<string>",
"parameter_spec": [
{
"key": "<string>",
"label": "<string>",
"type": "string",
"options": [
"<string>"
],
"default": "<unknown>",
"constrains": "<string>"
}
],
"values": {},
"revision": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"result_summary": {
"state": "passed",
"violations_count": 1,
"affected_files_count": 1,
"affected_components_count": 1,
"missing_enrichments": [
"<string>"
],
"error_message": "<string>",
"last_evaluated_at": "2023-11-07T05:31:56Z"
}
}
}
]
},
"policies": [
{
"id": 123,
"slug": "<string>",
"source": "seed",
"module": "<string>",
"category": "<string>",
"name": "<string>",
"description": "<string>",
"agent_rule": "<string>",
"agent_rule_stale": true,
"enabled": true,
"action": "block",
"expression": "<string>",
"parameter_spec": [
{
"key": "<string>",
"label": "<string>",
"type": "string",
"options": [
"<string>"
],
"default": "<unknown>",
"constrains": "<string>"
}
],
"values": {},
"revision": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"result_summary": {
"state": "passed",
"violations_count": 1,
"affected_files_count": 1,
"affected_components_count": 1,
"missing_enrichments": [
"<string>"
],
"error_message": "<string>",
"last_evaluated_at": "2023-11-07T05:31:56Z"
}
}
]
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "no_fixture",
"module": "<string>"
}Authorizations
An Earnie API key, sent as Authorization: Bearer sk_earnie_.... Create one under Settings > API keys. The key's scopes decide which operations it may call.