0

Retrieve Attributes

by
Published Oct 11, 2024

This endpoint retrieves the list of attributes associated with a collection or list.

Script zixflow Verified

The script

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

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

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

10
	const response = await fetch(endpoint, {
11
		method: 'GET',
12
		headers: {
13
			Authorization: `Bearer ${resource.apiKey}`
14
		}
15
	})
16

17
	if (!response.ok) {
18
		throw new Error(`HTTP error! status: ${response.status}`)
19
	}
20

21
	const data = await response.json()
22

23
	return data
24
}
25