0

Update a Longview plan

by
Published Oct 17, 2025

Update your Longview plan to that of the given subscription ID.

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 Longview plan
7
 * Update your Longview plan to that of the given subscription ID.
8
 */
9
export async function main(
10
  auth: Linode,
11
  apiVersion: "v4" | "v4beta",
12
  body: {
13
    longview_subscription?:
14
      | "longview-3"
15
      | "longview-10"
16
      | "longview-40"
17
      | "longview-100";
18
  },
19
) {
20
  const url = new URL(`https://api.linode.com/${apiVersion}/longview/plan`);
21

22
  const response = await fetch(url, {
23
    method: "PUT",
24
    headers: {
25
      "Content-Type": "application/json",
26
      Authorization: "Bearer " + auth.token,
27
    },
28
    body: JSON.stringify(body),
29
  });
30
  if (!response.ok) {
31
    const text = await response.text();
32
    throw new Error(`${response.status} ${text}`);
33
  }
34
  return await response.json();
35
}
36