//native
/**
* Get Ticket
* Retrieve a ticket's properties (subject, status, requester, custom fields...). Comments are not included: use List Ticket Comments.
*/
export async function main(auth: RT.Zendesk, ticket_id: number) {
const response = await fetch(
`https://${auth.subdomain}.zendesk.com/api/v2/tickets/${ticket_id}`,
{
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