//native
type SageIntacct = {
token: string
}
/**
* Delete a price list
* Deletes a purchasing price list. A price list can be deleted if it has not been assigned to any objects. This removes the price list and all of its associated price list entries from the system.
Permissions and other requirements
SubscriptionPurchasing
User typeBusiness, Warehouse
PermissionsList, View, Delete Price Lists
*/
export async function main(auth: SageIntacct, key: string) {
const url = new URL(`https://api.intacct.com/ia/api/v1/objects/purchasing/price-list/${key}`)
const response = await fetch(url, {
method: 'DELETE',
headers: {
Authorization: 'Bearer ' + auth.token
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.text()
}
Submitted by hugo697 235 days ago