Modificar un protocolo
curl --request PATCH \
--url https://app.blockgence.com/v1/guard/protocols/{pid} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "<string>",
"rules": {},
"status": "<string>",
"events": [
{}
]
}
'import requests
url = "https://app.blockgence.com/v1/guard/protocols/{pid}"
payload = {
"name": "<string>",
"rules": {},
"status": "<string>",
"events": [{}]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', rules: {}, status: '<string>', events: [{}]})
};
fetch('https://app.blockgence.com/v1/guard/protocols/{pid}', 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.blockgence.com/v1/guard/protocols/{pid}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'rules' => [
],
'status' => '<string>',
'events' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.blockgence.com/v1/guard/protocols/{pid}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"rules\": {},\n \"status\": \"<string>\",\n \"events\": [\n {}\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.patch("https://app.blockgence.com/v1/guard/protocols/{pid}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"rules\": {},\n \"status\": \"<string>\",\n \"events\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.blockgence.com/v1/guard/protocols/{pid}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"rules\": {},\n \"status\": \"<string>\",\n \"events\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"detail": "<string>",
"error": "<string>"
}{
"detail": "<string>",
"error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"detail": "<string>",
"error": "<string>"
}Guard
Modificar un protocolo
Cambia el nombre, las reglas, el estado o los eventos propios de un protocolo de Watchtower.
Cuerpo del pedido con cualquiera de estos campos:
name;rules: se combinan con las vigentes;status:activeopaused;events: la lista completa de eventos propios, con el formato dePOST /v1/guard/protocols. Reemplaza la anterior. Un evento ya guardado se reenvía con suid.
Las reglas y el estado se aplican a todos sus contratos. Responde el protocolo, con la misma forma que
GET /v1/guard/protocols/{pid}.
Lo edita su dueño o, si está compartido, un administrador de la organización.
Errores:
400: regla, estado o evento inválidos.403: quien consulta ve el protocolo pero no puede editarlo, o la clave de API no está asignada a una persona.404: el protocolo no existe, quien consulta no lo ve o Watchtower no está habilitado.422: el cuerpo del pedido trae un campo desconocido.502: no se pudo leer el ABI verificado que necesita un evento;detail.failuredescribe la falla.
Costo: sin cargo.
PATCH
/
v1
/
guard
/
protocols
/
{pid}
Modificar un protocolo
curl --request PATCH \
--url https://app.blockgence.com/v1/guard/protocols/{pid} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "<string>",
"rules": {},
"status": "<string>",
"events": [
{}
]
}
'import requests
url = "https://app.blockgence.com/v1/guard/protocols/{pid}"
payload = {
"name": "<string>",
"rules": {},
"status": "<string>",
"events": [{}]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', rules: {}, status: '<string>', events: [{}]})
};
fetch('https://app.blockgence.com/v1/guard/protocols/{pid}', 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.blockgence.com/v1/guard/protocols/{pid}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'rules' => [
],
'status' => '<string>',
'events' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.blockgence.com/v1/guard/protocols/{pid}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"rules\": {},\n \"status\": \"<string>\",\n \"events\": [\n {}\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.patch("https://app.blockgence.com/v1/guard/protocols/{pid}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"rules\": {},\n \"status\": \"<string>\",\n \"events\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.blockgence.com/v1/guard/protocols/{pid}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"rules\": {},\n \"status\": \"<string>\",\n \"events\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"detail": "<string>",
"error": "<string>"
}{
"detail": "<string>",
"error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"detail": "<string>",
"error": "<string>"
}Autorizaciones
APIKeyHeaderBearerAuth
Encabezados
Parámetros de ruta
Cuerpo
application/json
Respuesta
Respuesta correcta.