Update Startup Script
curl --request PATCH \
--url https://api.cloud.onidel.com/startup_scripts/{script_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Updated Script Name",
"content": "#!/bin/bash\napt-get update && apt-get install -y nginx certbot",
"team_id": "c1d45377-b2a9-4407-ab8d-6909c34dfaac",
"raw_user_data": false
}
'import requests
url = "https://api.cloud.onidel.com/startup_scripts/{script_id}"
payload = {
"name": "Updated Script Name",
"content": "#!/bin/bash
apt-get update && apt-get install -y nginx certbot",
"team_id": "c1d45377-b2a9-4407-ab8d-6909c34dfaac",
"raw_user_data": False
}
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({
name: 'Updated Script Name',
content: '#!/bin/bash\napt-get update && apt-get install -y nginx certbot',
team_id: 'c1d45377-b2a9-4407-ab8d-6909c34dfaac',
raw_user_data: false
})
};
fetch('https://api.cloud.onidel.com/startup_scripts/{script_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://api.cloud.onidel.com/startup_scripts/{script_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([
'name' => 'Updated Script Name',
'content' => '#!/bin/bash
apt-get update && apt-get install -y nginx certbot',
'team_id' => 'c1d45377-b2a9-4407-ab8d-6909c34dfaac',
'raw_user_data' => false
]),
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://api.cloud.onidel.com/startup_scripts/{script_id}"
payload := strings.NewReader("{\n \"name\": \"Updated Script Name\",\n \"content\": \"#!/bin/bash\\napt-get update && apt-get install -y nginx certbot\",\n \"team_id\": \"c1d45377-b2a9-4407-ab8d-6909c34dfaac\",\n \"raw_user_data\": false\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://api.cloud.onidel.com/startup_scripts/{script_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Updated Script Name\",\n \"content\": \"#!/bin/bash\\napt-get update && apt-get install -y nginx certbot\",\n \"team_id\": \"c1d45377-b2a9-4407-ab8d-6909c34dfaac\",\n \"raw_user_data\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloud.onidel.com/startup_scripts/{script_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 \"name\": \"Updated Script Name\",\n \"content\": \"#!/bin/bash\\napt-get update && apt-get install -y nginx certbot\",\n \"team_id\": \"c1d45377-b2a9-4407-ab8d-6909c34dfaac\",\n \"raw_user_data\": false\n}"
response = http.request(request)
puts response.read_bodyStartup Scripts
Update Startup Script
Update an existing startup script. raw_user_data toggles pass-through mode; omit it to keep the current mode.
PATCH
/
startup_scripts
/
{script_id}
Update Startup Script
curl --request PATCH \
--url https://api.cloud.onidel.com/startup_scripts/{script_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Updated Script Name",
"content": "#!/bin/bash\napt-get update && apt-get install -y nginx certbot",
"team_id": "c1d45377-b2a9-4407-ab8d-6909c34dfaac",
"raw_user_data": false
}
'import requests
url = "https://api.cloud.onidel.com/startup_scripts/{script_id}"
payload = {
"name": "Updated Script Name",
"content": "#!/bin/bash
apt-get update && apt-get install -y nginx certbot",
"team_id": "c1d45377-b2a9-4407-ab8d-6909c34dfaac",
"raw_user_data": False
}
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({
name: 'Updated Script Name',
content: '#!/bin/bash\napt-get update && apt-get install -y nginx certbot',
team_id: 'c1d45377-b2a9-4407-ab8d-6909c34dfaac',
raw_user_data: false
})
};
fetch('https://api.cloud.onidel.com/startup_scripts/{script_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://api.cloud.onidel.com/startup_scripts/{script_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([
'name' => 'Updated Script Name',
'content' => '#!/bin/bash
apt-get update && apt-get install -y nginx certbot',
'team_id' => 'c1d45377-b2a9-4407-ab8d-6909c34dfaac',
'raw_user_data' => false
]),
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://api.cloud.onidel.com/startup_scripts/{script_id}"
payload := strings.NewReader("{\n \"name\": \"Updated Script Name\",\n \"content\": \"#!/bin/bash\\napt-get update && apt-get install -y nginx certbot\",\n \"team_id\": \"c1d45377-b2a9-4407-ab8d-6909c34dfaac\",\n \"raw_user_data\": false\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://api.cloud.onidel.com/startup_scripts/{script_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Updated Script Name\",\n \"content\": \"#!/bin/bash\\napt-get update && apt-get install -y nginx certbot\",\n \"team_id\": \"c1d45377-b2a9-4407-ab8d-6909c34dfaac\",\n \"raw_user_data\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloud.onidel.com/startup_scripts/{script_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 \"name\": \"Updated Script Name\",\n \"content\": \"#!/bin/bash\\napt-get update && apt-get install -y nginx certbot\",\n \"team_id\": \"c1d45377-b2a9-4407-ab8d-6909c34dfaac\",\n \"raw_user_data\": false\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Body
application/json
Pass-through mode. When true the script content is sent to the instance verbatim as the cloud-init user-data, replacing the auto-generated user-data (hostname, password, SSH keys and guest agent setup). Configure those yourself in the content. Network configuration is still provided separately. When false (default) the content is wrapped into the generated user-data and executed as a script on first boot. Omit to keep the current mode. Must be a JSON boolean.
Example:
false
Response
Startup script updated successfully