#### Allowed For - Agents
by hugo697 ยท 11/7/2023
1
type Zendesk = {
2
username: string;
3
password: string;
4
subdomain: string;
5
};
6
/**
7
* List Bookmarks
8
* #### Allowed For
9
- Agents
10
*/
11
export async function main(auth: Zendesk) {
12
const url = new URL(`https://${auth.subdomain}.zendesk.com/api/v2/bookmarks`);
13
14
const response = await fetch(url, {
15
method: "GET",
16
headers: {
17
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
18
},
19
body: undefined,
20
});
21
if (!response.ok) {
22
const text = await response.text();
23
throw new Error(`${response.status} ${text}`);
24
}
25
return await response.json();
26
27