0

Delete Custom Attribute

by
Published Oct 11, 2024

This endpoint allows the deletion of a custom attribute.

Script zixflow Verified

The script

Submitted by hugo697 Bun
Verified 606 days ago
1
//native
2

3
type Zixflow = {
4
	apiKey: string
5
}
6

7
export async function main(
8
	resource: Zixflow,
9
	target: 'collection' | 'list',
10
	targetId: string,
11
	attributeId: string
12
) {
13
	const endpoint = `https://api.zixflow.com/api/v1/attributes/${target}/${targetId}/${attributeId}`
14

15
	const response = await fetch(endpoint, {
16
		method: 'DELETE',
17
		headers: {
18
			Authorization: `Bearer ${resource.apiKey}`,
19
			'Content-Type': 'application/json'
20
		}
21
	})
22

23
	if (!response.ok) {
24
		throw new Error(`HTTP error! status: ${response.status}`)
25
	}
26

27
	const data = await response.json()
28

29
	return data
30
}
31