0

Create an item warehouse vendor

by
Published Oct 17, 2025

Creates a new item warehouse vendor.

Script sage_intacct Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type SageIntacct = {
3
	token: string
4
}
5
/**
6
 * Create an item warehouse vendor
7
 * Creates a new item warehouse vendor.
8
 */
9
export async function main(
10
	auth: SageIntacct,
11
	body: {
12
		key?: string
13
		id?: string
14
		itemWarehouse?: { key?: string; id?: string; href?: string }
15
		vendor?: { key?: string; id?: string; href?: string }
16
		stockNumber?: string
17
		leadTime?: number
18
		demandForecastDuringLeadTime?: number
19
		economicalOrderQuantity?: number
20
		vendorMinimumOrderQuantity?: number
21
		bestPrice?: string
22
		latestPrice?: string
23
		unitOfMeasure?: { key?: string; id?: string; href?: string }
24
		conversionFactor?: string
25
		isPreferredVendor?: false | true
26
		href?: string
27
	} & { itemWarehouse?: {} }
28
) {
29
	const url = new URL(
30
		`https://api.intacct.com/ia/api/v1/objects/inventory-control/item-warehouse-vendor`
31
	)
32

33
	const response = await fetch(url, {
34
		method: 'POST',
35
		headers: {
36
			'Content-Type': 'application/json',
37
			Authorization: 'Bearer ' + auth.token
38
		},
39
		body: JSON.stringify(body)
40
	})
41
	if (!response.ok) {
42
		const text = await response.text()
43
		throw new Error(`${response.status} ${text}`)
44
	}
45
	return await response.json()
46
}
47