0

Create an item warehouse standard cost object

by
Published Oct 17, 2025

Creates a new item warehouse standard cost object.

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 standard cost object
7
 * Creates a new item warehouse standard cost object.
8
 */
9
export async function main(
10
	auth: SageIntacct,
11
	body: {
12
		key?: string
13
		id?: string
14
		href?: string
15
		effectiveStartDate?: string
16
		standardCost?: string
17
		itemWarehouse?: {
18
			key?: string
19
			id?: string
20
			href?: string
21
			itemId?: string
22
			warehouseId?: string
23
		}
24
		audit?: {
25
			createdDateTime?: string
26
			modifiedDateTime?: string
27
			createdBy?: string
28
			modifiedBy?: string
29
		}
30
	} & { itemWarehouse?: {} }
31
) {
32
	const url = new URL(
33
		`https://api.intacct.com/ia/api/v1/objects/inventory-control/item-warehouse-standard-cost`
34
	)
35

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