0

Delete a translation for a term

by
Published Oct 17, 2025

Delete an existing translation of a term in a term base (previously: glossary).

Script phrase Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Phrase = {
3
	token: string
4
	baseUrl: string
5
}
6
/**
7
 * Delete a translation for a term
8
 * Delete an existing translation of a term in a term base (previously: glossary).
9
 */
10
export async function main(
11
	auth: Phrase,
12
	account_id: string,
13
	glossary_id: string,
14
	term_id: string,
15
	id: string
16
) {
17
	const url = new URL(
18
		`${auth.baseUrl}/accounts/${account_id}/glossaries/${glossary_id}/terms/${term_id}/translations/${id}`
19
	)
20

21
	const response = await fetch(url, {
22
		method: 'DELETE',
23
		headers: {
24
			Authorization: 'ApiToken ' + auth.token
25
		},
26
		body: undefined
27
	})
28
	if (!response.ok) {
29
		const text = await response.text()
30
		throw new Error(`${response.status} ${text}`)
31
	}
32
	return await response.text()
33
}
34