Edits history of script submission #18781 for ' Approve a vendor (sage_intacct)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type SageIntacct = {
    	token: string
    }
    /**
     * Approve a vendor
     * When vendor approval is enabled, new and recently edited vendors are automatically submitted to an approval queue. Designated approvers review those vendors and either approve or decline them. For more information, see [About vendor approvals](https://www.intacct.com/ia/docs/en_US/help_action/Accounts_Payable/Approvals/Vendor_approvals/about-vendor-approvals.htm?TocPath=Applications%7CAccounts%20Payable%7CSetup%7CApprovals%7CVendor%20approval%7C_____1) in the Sage Intacct Help Center.
     */
    export async function main(auth: SageIntacct, body: { key?: string; notes?: string }) {
    	const url = new URL(`https://api.intacct.com/ia/api/v1/workflows/accounts-payable/vendor/approve`)
    
    	const response = await fetch(url, {
    		method: 'POST',
    		headers: {
    			'Content-Type': 'application/json',
    			Authorization: 'Bearer ' + auth.token
    		},
    		body: JSON.stringify(body)
    	})
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    	return await response.json()
    }
    

    Submitted by hugo697 235 days ago