Hosts
Update a host
Requires host.manage. Changing accounts changes which Unix accounts the host will authorize, and is pushed as a fresh snapshot.
PATCH
/
hosts
/
{id}
Update a host
curl --request PATCH \
--url https://custos.example.com/hosts/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"label": "<string>",
"ssh_address": "<string>",
"accounts": [
"<string>"
]
}
'import requests
url = "https://custos.example.com/hosts/{id}"
payload = {
"label": "<string>",
"ssh_address": "<string>",
"accounts": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({label: '<string>', ssh_address: '<string>', accounts: ['<string>']})
};
fetch('https://custos.example.com/hosts/{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://custos.example.com/hosts/{id}",
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([
'label' => '<string>',
'ssh_address' => '<string>',
'accounts' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://custos.example.com/hosts/{id}"
payload := strings.NewReader("{\n \"label\": \"<string>\",\n \"ssh_address\": \"<string>\",\n \"accounts\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://custos.example.com/hosts/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"<string>\",\n \"ssh_address\": \"<string>\",\n \"accounts\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://custos.example.com/hosts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"label\": \"<string>\",\n \"ssh_address\": \"<string>\",\n \"accounts\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"hostname": "<string>",
"ssh_endpoint": {
"address": "<string>",
"source": "<string>"
},
"accounts": [
"<string>"
],
"status": "<string>",
"connection_status": "<string>",
"agent_version": "<string>",
"desired_version": "<string>",
"enrolled_at": "2023-11-07T05:31:56Z",
"last_seen_at": "2023-11-07T05:31:56Z",
"permissions": [
"<string>"
]
}Authorizations
An opaque access token from /login or /refresh. Tokens are checked against the database on every request, so revocation is immediate.
Path Parameters
Body
application/json
Response
The updated host
Show child attributes
Show child attributes
The Unix accounts this host manages.
Whether a daemon is currently connected.
The caller's permissions on this host.
⌘I
Update a host
curl --request PATCH \
--url https://custos.example.com/hosts/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"label": "<string>",
"ssh_address": "<string>",
"accounts": [
"<string>"
]
}
'import requests
url = "https://custos.example.com/hosts/{id}"
payload = {
"label": "<string>",
"ssh_address": "<string>",
"accounts": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({label: '<string>', ssh_address: '<string>', accounts: ['<string>']})
};
fetch('https://custos.example.com/hosts/{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://custos.example.com/hosts/{id}",
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([
'label' => '<string>',
'ssh_address' => '<string>',
'accounts' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://custos.example.com/hosts/{id}"
payload := strings.NewReader("{\n \"label\": \"<string>\",\n \"ssh_address\": \"<string>\",\n \"accounts\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://custos.example.com/hosts/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"<string>\",\n \"ssh_address\": \"<string>\",\n \"accounts\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://custos.example.com/hosts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"label\": \"<string>\",\n \"ssh_address\": \"<string>\",\n \"accounts\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"hostname": "<string>",
"ssh_endpoint": {
"address": "<string>",
"source": "<string>"
},
"accounts": [
"<string>"
],
"status": "<string>",
"connection_status": "<string>",
"agent_version": "<string>",
"desired_version": "<string>",
"enrolled_at": "2023-11-07T05:31:56Z",
"last_seen_at": "2023-11-07T05:31:56Z",
"permissions": [
"<string>"
]
}