//native
/**
* Remove Ticket Tags
* Remove tags from a ticket; tags it doesn't have are ignored. Returns the ticket's remaining tags.
*/
export async function main(
auth: RT.Zendesk,
ticket_id: number,
tags: string[]
) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/tickets/${ticket_id}/tags`
)
url.searchParams.append("tags", tags.join(","))
const response = await fetch(url, {
method: "DELETE",
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