0

Update a managed service

by
Published Oct 17, 2025

Updates information about a Managed Service.

Script linode Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Linode = {
3
  token: string;
4
};
5
/**
6
 * Update a managed service
7
 * Updates information about a Managed Service.
8
 */
9
export async function main(
10
  auth: Linode,
11
  apiVersion: "v4" | "v4beta",
12
  serviceId: string,
13
  body: {
14
    address?: string;
15
    body?: string;
16
    consultation_group?: string;
17
    created?: string;
18
    credentials?: number[];
19
    id?: number;
20
    label?: string;
21
    notes?: string;
22
    region?: string;
23
    service_type?: "url" | "tcp";
24
    status?: "disabled" | "pending" | "ok" | "problem";
25
    timeout?: number;
26
    updated?: string;
27
  },
28
) {
29
  const url = new URL(
30
    `https://api.linode.com/${apiVersion}/managed/services/${serviceId}`,
31
  );
32

33
  const response = await fetch(url, {
34
    method: "PUT",
35
    headers: {
36
      "Content-Type": "application/json",
37
      Authorization: "Bearer " + auth.token,
38
    },
39
    body: JSON.stringify(body),
40
  });
41
  if (!response.ok) {
42
    const text = await response.text();
43
    throw new Error(`${response.status} ${text}`);
44
  }
45
  return await response.json();
46
}
47