Skip to main content
PUT
/
v0
/
serverhosts
Update a serverhost
curl --request PUT \
  --url https://controller.platform.simplecloud.app/v0/serverhosts \
  --header 'Content-Type: application/json' \
  --header 'X-Network-ID: <x-network-id>' \
  --header 'X-Network-Secret: <x-network-secret>' \
  --data '
{
  "host_name": "ServerHost-1",
  "maximum_memory": 8192,
  "serverhost_access_mode": "MANAGED_GATEWAY",
  "serverhost_custom_url": "https://files.example.com"
}
'
import requests

url = "https://controller.platform.simplecloud.app/v0/serverhosts"

payload = {
"host_name": "ServerHost-1",
"maximum_memory": 8192,
"serverhost_access_mode": "MANAGED_GATEWAY",
"serverhost_custom_url": "https://files.example.com"
}
headers = {
"X-Network-ID": "<x-network-id>",
"X-Network-Secret": "<x-network-secret>",
"Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {
'X-Network-ID': '<x-network-id>',
'X-Network-Secret': '<x-network-secret>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
host_name: 'ServerHost-1',
maximum_memory: 8192,
serverhost_access_mode: 'MANAGED_GATEWAY',
serverhost_custom_url: 'https://files.example.com'
})
};

fetch('https://controller.platform.simplecloud.app/v0/serverhosts', 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://controller.platform.simplecloud.app/v0/serverhosts",
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([
'host_name' => 'ServerHost-1',
'maximum_memory' => 8192,
'serverhost_access_mode' => 'MANAGED_GATEWAY',
'serverhost_custom_url' => 'https://files.example.com'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Network-ID: <x-network-id>",
"X-Network-Secret: <x-network-secret>"
],
]);

$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://controller.platform.simplecloud.app/v0/serverhosts"

payload := strings.NewReader("{\n \"host_name\": \"ServerHost-1\",\n \"maximum_memory\": 8192,\n \"serverhost_access_mode\": \"MANAGED_GATEWAY\",\n \"serverhost_custom_url\": \"https://files.example.com\"\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("X-Network-ID", "<x-network-id>")
req.Header.Add("X-Network-Secret", "<x-network-secret>")
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://controller.platform.simplecloud.app/v0/serverhosts")
.header("X-Network-ID", "<x-network-id>")
.header("X-Network-Secret", "<x-network-secret>")
.header("Content-Type", "application/json")
.body("{\n \"host_name\": \"ServerHost-1\",\n \"maximum_memory\": 8192,\n \"serverhost_access_mode\": \"MANAGED_GATEWAY\",\n \"serverhost_custom_url\": \"https://files.example.com\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://controller.platform.simplecloud.app/v0/serverhosts")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["X-Network-ID"] = '<x-network-id>'
request["X-Network-Secret"] = '<x-network-secret>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"host_name\": \"ServerHost-1\",\n \"maximum_memory\": 8192,\n \"serverhost_access_mode\": \"MANAGED_GATEWAY\",\n \"serverhost_custom_url\": \"https://files.example.com\"\n}"

response = http.request(request)
puts response.read_body
{
  "auto_update_targeted_version": true,
  "created_at": "2023-01-01T12:00:00Z",
  "deactivated": false,
  "deactivated_at": "2023-01-01T12:00:00Z",
  "host_name": "ServerHost-1",
  "installed_java_versions": [
    8,
    17,
    21
  ],
  "last_keep_alive": "2023-01-01T12:00:00Z",
  "maximum_memory": 8192,
  "message": "Serverhost updated successfully",
  "network_id": "123e4567-e89b-12d3-a456-426614174000",
  "serverhost_access_mode": "MANAGED_GATEWAY",
  "serverhost_custom_url": "https://files.example.com",
  "serverhost_gateway_last_connected_at": "2023-01-01T12:00:00Z",
  "serverhost_gateway_slug": "9f1f7f2c9a224bb29f9e0f7e5b2a070a",
  "serverhost_id": "123e4567-e89b-12d3-a456-426614174000",
  "started_at": "2023-01-01T12:00:00Z",
  "targeted_version": "1.2.3",
  "updated_at": "2023-01-01T12:00:00Z"
}
{
"error": "<string>"
}
{
"error": "<string>"
}
{
"error": "<string>"
}
{
"error": "<string>"
}
{
"error": "<string>"
}

Headers

X-Network-ID
string
required

Network ID

X-Network-Secret
string
required

Network Secret

Query Parameters

serverhost_id
string
required

Serverhost ID

Body

application/json

Serverhost details

Request to update a serverhost

host_name
string
Example:

"ServerHost-1"

maximum_memory
integer
Example:

8192

serverhost_access_mode
string
Example:

"MANAGED_GATEWAY"

serverhost_custom_url
string
Example:

"https://files.example.com"

Response

OK

Response for updating a serverhost

auto_update_targeted_version
boolean
Example:

true

created_at
string
Example:

"2023-01-01T12:00:00Z"

deactivated
boolean
Example:

false

deactivated_at
string
Example:

"2023-01-01T12:00:00Z"

host_name
string
Example:

"ServerHost-1"

installed_java_versions
integer[]
Example:
[8, 17, 21]
last_keep_alive
string
Example:

"2023-01-01T12:00:00Z"

maximum_memory
integer
Example:

8192

message
string
Example:

"Serverhost updated successfully"

network_id
string
Example:

"123e4567-e89b-12d3-a456-426614174000"

serverhost_access_mode
string
Example:

"MANAGED_GATEWAY"

serverhost_custom_url
string
Example:

"https://files.example.com"

serverhost_gateway_last_connected_at
string
Example:

"2023-01-01T12:00:00Z"

serverhost_gateway_slug
string
Example:

"9f1f7f2c9a224bb29f9e0f7e5b2a070a"

serverhost_id
string
Example:

"123e4567-e89b-12d3-a456-426614174000"

started_at
string
Example:

"2023-01-01T12:00:00Z"

targeted_version
string
Example:

"1.2.3"

updated_at
string
Example:

"2023-01-01T12:00:00Z"