0

Delete Report Template

by
Published Nov 5, 2024

Deletes a Report Template.

Script motimate Verified

The script

Submitted by hugo697 Bun
Verified 581 days ago
1
//native
2
type Motimate = {
3
	token: string
4
}
5

6
export async function main(auth: Motimate, report_template_id: string) {
7
	const url = new URL(
8
		`https://motimateapp.com/public_api/insights/learnings/report_templates/${report_template_id}`
9
	)
10

11
	const response = await fetch(url, {
12
		method: 'DELETE',
13
		headers: {
14
			Authorization: 'Bearer ' + auth.token
15
		}
16
	})
17

18
	if (!response.ok) {
19
		const text = await response.text()
20
		throw new Error(`${response.status} ${text}`)
21
	}
22

23
	return await response.text()
24
}
25