//native
/**
* Get Dynamic Content Items by Name
* Retrieve several dynamic content items by their identifier (the `name` in `{{dc.name}}`), with their variants.
*/
export async function main(auth: RT.Zendesk, identifiers: string[]) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/dynamic_content/items/show_many`
)
url.searchParams.append("identifiers", identifiers.join(","))
const response = await fetch(url, {
headers: {
Authorization: auth.token
? `Bearer ${auth.token}`
: `Basic ${btoa(`${auth.username}:${auth.password}`)}`,
Accept: "application/json",
},
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 2 hours ago