Update AI Session Analyzer Rule
curl --request PUT \
--url https://use.hoop.dev/api/ai/session-analyzer/rules/{name} \
--header 'Content-Type: application/json' \
--data '
{
"connection_names": [
"pgdemo",
"mysql-prod"
],
"name": "block-dangerous-queries",
"risk_evaluation": {
"high_risk_action": "block_execution",
"low_risk_action": "allow_execution",
"medium_risk_action": "allow_execution"
},
"description": "Blocks high-risk SQL commands"
}
'import requests
url = "https://use.hoop.dev/api/ai/session-analyzer/rules/{name}"
payload = {
"connection_names": ["pgdemo", "mysql-prod"],
"name": "block-dangerous-queries",
"risk_evaluation": {
"high_risk_action": "block_execution",
"low_risk_action": "allow_execution",
"medium_risk_action": "allow_execution"
},
"description": "Blocks high-risk SQL commands"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
connection_names: ['pgdemo', 'mysql-prod'],
name: 'block-dangerous-queries',
risk_evaluation: {
high_risk_action: 'block_execution',
low_risk_action: 'allow_execution',
medium_risk_action: 'allow_execution'
},
description: 'Blocks high-risk SQL commands'
})
};
fetch('https://use.hoop.dev/api/ai/session-analyzer/rules/{name}', 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://use.hoop.dev/api/ai/session-analyzer/rules/{name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'connection_names' => [
'pgdemo',
'mysql-prod'
],
'name' => 'block-dangerous-queries',
'risk_evaluation' => [
'high_risk_action' => 'block_execution',
'low_risk_action' => 'allow_execution',
'medium_risk_action' => 'allow_execution'
],
'description' => 'Blocks high-risk SQL commands'
]),
CURLOPT_HTTPHEADER => [
"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://use.hoop.dev/api/ai/session-analyzer/rules/{name}"
payload := strings.NewReader("{\n \"connection_names\": [\n \"pgdemo\",\n \"mysql-prod\"\n ],\n \"name\": \"block-dangerous-queries\",\n \"risk_evaluation\": {\n \"high_risk_action\": \"block_execution\",\n \"low_risk_action\": \"allow_execution\",\n \"medium_risk_action\": \"allow_execution\"\n },\n \"description\": \"Blocks high-risk SQL commands\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.put("https://use.hoop.dev/api/ai/session-analyzer/rules/{name}")
.header("Content-Type", "application/json")
.body("{\n \"connection_names\": [\n \"pgdemo\",\n \"mysql-prod\"\n ],\n \"name\": \"block-dangerous-queries\",\n \"risk_evaluation\": {\n \"high_risk_action\": \"block_execution\",\n \"low_risk_action\": \"allow_execution\",\n \"medium_risk_action\": \"allow_execution\"\n },\n \"description\": \"Blocks high-risk SQL commands\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://use.hoop.dev/api/ai/session-analyzer/rules/{name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"connection_names\": [\n \"pgdemo\",\n \"mysql-prod\"\n ],\n \"name\": \"block-dangerous-queries\",\n \"risk_evaluation\": {\n \"high_risk_action\": \"block_execution\",\n \"low_risk_action\": \"allow_execution\",\n \"medium_risk_action\": \"allow_execution\"\n },\n \"description\": \"Blocks high-risk SQL commands\"\n}"
response = http.request(request)
puts response.read_body{
"connection_names": [
"pgdemo",
"mysql-prod"
],
"created_at": "2024-07-25T15:56:35.317601Z",
"description": "Blocks high-risk SQL commands",
"id": "15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7",
"name": "block-dangerous-queries",
"risk_evaluation": {
"high_risk_action": "block_execution",
"low_risk_action": "allow_execution",
"medium_risk_action": "allow_execution"
},
"updated_at": "2024-07-25T15:56:35.317601Z"
}{
"message": "the error description"
}{
"message": "the error description"
}{
"message": "the error description"
}AI
Update AI Session Analyzer Rule
Update an existing AI session analyzer rule
PUT
/
ai
/
session-analyzer
/
rules
/
{name}
Update AI Session Analyzer Rule
curl --request PUT \
--url https://use.hoop.dev/api/ai/session-analyzer/rules/{name} \
--header 'Content-Type: application/json' \
--data '
{
"connection_names": [
"pgdemo",
"mysql-prod"
],
"name": "block-dangerous-queries",
"risk_evaluation": {
"high_risk_action": "block_execution",
"low_risk_action": "allow_execution",
"medium_risk_action": "allow_execution"
},
"description": "Blocks high-risk SQL commands"
}
'import requests
url = "https://use.hoop.dev/api/ai/session-analyzer/rules/{name}"
payload = {
"connection_names": ["pgdemo", "mysql-prod"],
"name": "block-dangerous-queries",
"risk_evaluation": {
"high_risk_action": "block_execution",
"low_risk_action": "allow_execution",
"medium_risk_action": "allow_execution"
},
"description": "Blocks high-risk SQL commands"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
connection_names: ['pgdemo', 'mysql-prod'],
name: 'block-dangerous-queries',
risk_evaluation: {
high_risk_action: 'block_execution',
low_risk_action: 'allow_execution',
medium_risk_action: 'allow_execution'
},
description: 'Blocks high-risk SQL commands'
})
};
fetch('https://use.hoop.dev/api/ai/session-analyzer/rules/{name}', 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://use.hoop.dev/api/ai/session-analyzer/rules/{name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'connection_names' => [
'pgdemo',
'mysql-prod'
],
'name' => 'block-dangerous-queries',
'risk_evaluation' => [
'high_risk_action' => 'block_execution',
'low_risk_action' => 'allow_execution',
'medium_risk_action' => 'allow_execution'
],
'description' => 'Blocks high-risk SQL commands'
]),
CURLOPT_HTTPHEADER => [
"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://use.hoop.dev/api/ai/session-analyzer/rules/{name}"
payload := strings.NewReader("{\n \"connection_names\": [\n \"pgdemo\",\n \"mysql-prod\"\n ],\n \"name\": \"block-dangerous-queries\",\n \"risk_evaluation\": {\n \"high_risk_action\": \"block_execution\",\n \"low_risk_action\": \"allow_execution\",\n \"medium_risk_action\": \"allow_execution\"\n },\n \"description\": \"Blocks high-risk SQL commands\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.put("https://use.hoop.dev/api/ai/session-analyzer/rules/{name}")
.header("Content-Type", "application/json")
.body("{\n \"connection_names\": [\n \"pgdemo\",\n \"mysql-prod\"\n ],\n \"name\": \"block-dangerous-queries\",\n \"risk_evaluation\": {\n \"high_risk_action\": \"block_execution\",\n \"low_risk_action\": \"allow_execution\",\n \"medium_risk_action\": \"allow_execution\"\n },\n \"description\": \"Blocks high-risk SQL commands\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://use.hoop.dev/api/ai/session-analyzer/rules/{name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"connection_names\": [\n \"pgdemo\",\n \"mysql-prod\"\n ],\n \"name\": \"block-dangerous-queries\",\n \"risk_evaluation\": {\n \"high_risk_action\": \"block_execution\",\n \"low_risk_action\": \"allow_execution\",\n \"medium_risk_action\": \"allow_execution\"\n },\n \"description\": \"Blocks high-risk SQL commands\"\n}"
response = http.request(request)
puts response.read_body{
"connection_names": [
"pgdemo",
"mysql-prod"
],
"created_at": "2024-07-25T15:56:35.317601Z",
"description": "Blocks high-risk SQL commands",
"id": "15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7",
"name": "block-dangerous-queries",
"risk_evaluation": {
"high_risk_action": "block_execution",
"low_risk_action": "allow_execution",
"medium_risk_action": "allow_execution"
},
"updated_at": "2024-07-25T15:56:35.317601Z"
}{
"message": "the error description"
}{
"message": "the error description"
}{
"message": "the error description"
}Path Parameters
The name of the resource
Body
application/json
The request body resource
Connection names this rule applies to
Example:
["pgdemo", "mysql-prod"]
Unique name for the rule
Example:
"block-dangerous-queries"
Risk evaluation actions per level
Show child attributes
Show child attributes
Optional description
Example:
"Blocks high-risk SQL commands"
Response
OK
Connection names this rule applies to
Example:
["pgdemo", "mysql-prod"]
The time the resource was created
Example:
"2024-07-25T15:56:35.317601Z"
Optional description
Example:
"Blocks high-risk SQL commands"
The resource identifier
Example:
"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7"
Unique name for the rule
Example:
"block-dangerous-queries"
Risk evaluation actions per level
Show child attributes
Show child attributes
The time the resource was updated
Example:
"2024-07-25T15:56:35.317601Z"
Was this page helpful?