0

Update a bin

by
Published Oct 17, 2025

Updates an existing bin by setting field values. Any fields not provided remain unchanged. Permissions and other requirements SubscriptionInventory Control ConfigurationAdvanced workflows is enabled. User typeBusiness PermissionsList, View, Edit Bins

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
 * Update a bin
7
 * Updates an existing bin by setting field values. Any fields not provided remain unchanged.
8

9

10
Permissions and other requirements
11

12
SubscriptionInventory Control
13
ConfigurationAdvanced workflows is enabled.
14
User typeBusiness
15
PermissionsList, View, Edit Bins
16

17

18

19

20
 */
21
export async function main(
22
	auth: SageIntacct,
23
	key: string,
24
	body: {
25
		key?: string
26
		id?: string
27
		description?: string
28
		href?: string
29
		warehouse?: { key?: string; id?: string; href?: string }
30
		aisle?: { key?: string; id?: string; href?: string }
31
		row?: { key?: string; id?: string; href?: string }
32
		zone?: { key?: string; id?: string; href?: string }
33
		binFace?: { key?: string; id?: string; href?: string }
34
		binSize?: { key?: string; id?: string; href?: string }
35
		sequenceNumber?: string
36
		isPortable?: false | true
37
		status?: 'active' | 'inactive'
38
		audit?: {
39
			createdDateTime?: string
40
			modifiedDateTime?: string
41
			createdBy?: string
42
			modifiedBy?: string
43
		}
44
	}
45
) {
46
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/inventory-control/bin/${key}`)
47

48
	const response = await fetch(url, {
49
		method: 'PATCH',
50
		headers: {
51
			'Content-Type': 'application/json',
52
			Authorization: 'Bearer ' + auth.token
53
		},
54
		body: JSON.stringify(body)
55
	})
56
	if (!response.ok) {
57
		const text = await response.text()
58
		throw new Error(`${response.status} ${text}`)
59
	}
60
	return await response.json()
61
}
62