Update Guard Rail Rules
curl --request PUT \
--url https://use.hoop.dev/api/guardrails/{id} \
--header 'Content-Type: application/json' \
--data '
{
"name": "my-strict-rule",
"connection_ids": [
"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7",
"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D8"
],
"description": "description about this rule",
"input": {},
"output": {}
}
'import requests
url = "https://use.hoop.dev/api/guardrails/{id}"
payload = {
"name": "my-strict-rule",
"connection_ids": ["15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7", "15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D8"],
"description": "description about this rule",
"input": {},
"output": {}
}
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({
name: 'my-strict-rule',
connection_ids: ['15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7', '15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D8'],
description: 'description about this rule',
input: {},
output: {}
})
};
fetch('https://use.hoop.dev/api/guardrails/{id}', 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/guardrails/{id}",
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([
'name' => 'my-strict-rule',
'connection_ids' => [
'15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7',
'15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D8'
],
'description' => 'description about this rule',
'input' => [
],
'output' => [
]
]),
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/guardrails/{id}"
payload := strings.NewReader("{\n \"name\": \"my-strict-rule\",\n \"connection_ids\": [\n \"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7\",\n \"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D8\"\n ],\n \"description\": \"description about this rule\",\n \"input\": {},\n \"output\": {}\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/guardrails/{id}")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"my-strict-rule\",\n \"connection_ids\": [\n \"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7\",\n \"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D8\"\n ],\n \"description\": \"description about this rule\",\n \"input\": {},\n \"output\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://use.hoop.dev/api/guardrails/{id}")
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 \"name\": \"my-strict-rule\",\n \"connection_ids\": [\n \"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7\",\n \"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D8\"\n ],\n \"description\": \"description about this rule\",\n \"input\": {},\n \"output\": {}\n}"
response = http.request(request)
puts response.read_body{
"connection_ids": [
"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7",
"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D8"
],
"created_at": "2024-07-25T15:56:35.317601Z",
"description": "description about this rule",
"id": "15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7",
"input": {},
"name": "my-strict-rule",
"output": {},
"updated_at": "2024-07-25T15:56:35.317601Z"
}{
"message": "the error description"
}{
"message": "the error description"
}Guard Rails
Update Guard Rail Rules
Update Guard Rail Rules
PUT
/
guardrails
/
{id}
Update Guard Rail Rules
curl --request PUT \
--url https://use.hoop.dev/api/guardrails/{id} \
--header 'Content-Type: application/json' \
--data '
{
"name": "my-strict-rule",
"connection_ids": [
"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7",
"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D8"
],
"description": "description about this rule",
"input": {},
"output": {}
}
'import requests
url = "https://use.hoop.dev/api/guardrails/{id}"
payload = {
"name": "my-strict-rule",
"connection_ids": ["15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7", "15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D8"],
"description": "description about this rule",
"input": {},
"output": {}
}
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({
name: 'my-strict-rule',
connection_ids: ['15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7', '15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D8'],
description: 'description about this rule',
input: {},
output: {}
})
};
fetch('https://use.hoop.dev/api/guardrails/{id}', 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/guardrails/{id}",
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([
'name' => 'my-strict-rule',
'connection_ids' => [
'15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7',
'15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D8'
],
'description' => 'description about this rule',
'input' => [
],
'output' => [
]
]),
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/guardrails/{id}"
payload := strings.NewReader("{\n \"name\": \"my-strict-rule\",\n \"connection_ids\": [\n \"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7\",\n \"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D8\"\n ],\n \"description\": \"description about this rule\",\n \"input\": {},\n \"output\": {}\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/guardrails/{id}")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"my-strict-rule\",\n \"connection_ids\": [\n \"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7\",\n \"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D8\"\n ],\n \"description\": \"description about this rule\",\n \"input\": {},\n \"output\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://use.hoop.dev/api/guardrails/{id}")
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 \"name\": \"my-strict-rule\",\n \"connection_ids\": [\n \"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7\",\n \"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D8\"\n ],\n \"description\": \"description about this rule\",\n \"input\": {},\n \"output\": {}\n}"
response = http.request(request)
puts response.read_body{
"connection_ids": [
"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7",
"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D8"
],
"created_at": "2024-07-25T15:56:35.317601Z",
"description": "description about this rule",
"id": "15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7",
"input": {},
"name": "my-strict-rule",
"output": {},
"updated_at": "2024-07-25T15:56:35.317601Z"
}{
"message": "the error description"
}{
"message": "the error description"
}Body
application/json
The request body resource
Unique name for the rule
Example:
"my-strict-rule"
List of connection IDs that this guardrail applies to
Example:
[
"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7",
"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D8"
]
The rule description
Example:
"description about this rule"
The input rule
{
"name": "deny-select",
"description": "<optional-description>",
"input": {
"rules": [
{"type": "deny_words_list", "words": ["SELECT"], "pattern_regex": ""}
]
},
"output": {
"rules": [
{"type": "pattern_match", "words": [], "pattern_regex": "[A-Z0-9]+"}
]
}
}
Show child attributes
Show child attributes
The output rule
{
"name": "deny-select",
"description": "<optional-description>",
"input": {
"rules": [
{"type": "deny_words_list", "words": ["SELECT"], "pattern_regex": ""}
]
},
"output": {
"rules": [
{"type": "pattern_match", "words": [], "pattern_regex": "[A-Z0-9]+"}
]
}
}
Show child attributes
Show child attributes
Response
OK
List of connection IDs that this guardrail applies to
Example:
[
"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7",
"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D8"
]
The time the resource was created
Example:
"2024-07-25T15:56:35.317601Z"
The rule description
Example:
"description about this rule"
The resource identifier
Example:
"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7"
The input rule
{
"name": "deny-select",
"description": "<optional-description>",
"input": {
"rules": [
{"type": "deny_words_list", "words": ["SELECT"], "pattern_regex": "", "name": "<optional-name>"}
]
},
"output": {
"rules": [
{"type": "pattern_match", "words": [], "pattern_regex": "[A-Z0-9]+"}
]
}
}
Show child attributes
Show child attributes
Unique name for the rule
Example:
"my-strict-rule"
The output rule
{
"name": "deny-select",
"description": "<optional-description>",
"input": {
"rules": [
{"type": "deny_words_list", "words": ["SELECT"], "pattern_regex": "", "name": "<optional-name>"}
]
},
"output": {
"rules": [
{"type": "pattern_match", "words": [], "pattern_regex": "[A-Z0-9]+"}
]
}
}
Show child attributes
Show child attributes
The time the resource was updated
Example:
"2024-07-25T15:56:35.317601Z"
Was this page helpful?
⌘I