type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Update Ticket Field
* #### Updating drop-down field options
You can also use the update endpoint to add, update, or remove options in a drop-down custom field.
*/
export async function main(auth: Zendesk, ticket_field_id: string) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/ticket_fields/${ticket_field_id}`
);
const response = await fetch(url, {
method: "PUT",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 71 days ago
type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Update Ticket Field
* #### Updating drop-down field options
You can also use the update endpoint to add, update, or remove options in a drop-down custom field.
*/
export async function main(auth: Zendesk, ticket_field_id: string) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/ticket_fields/${ticket_field_id}`
);
const response = await fetch(url, {
method: "PUT",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 618 days ago