//native
type SageIntacct = {
token: string
}
/**
* Update a unit of measure group
* Updates an existing unit of measure group by setting field values. Any fields not provided remain unchanged.
Permissions and other requirements
SubscriptionInventory Control, Order Entry, or Purchasing
ConfigurationInventory Control, Order Entry, or Purchasing must be enabled for custom units of measure to add, edit, or delete unit of measure groups.
User typeBusiness
PermissionsList, View, Edit Unit of Measure groups
*/
export async function main(
auth: SageIntacct,
key: string,
body: {
key?: string
id?: string
baseUnit?: string
abbreviation?: string
isSystemGenerated?: false | true
defaults?: {
inventory?: { key?: string; id?: string; href?: string }
purchaseOrder?: { key?: string; id?: string; href?: string }
orderEntry?: { key?: string; id?: string; href?: string }
}
unitsOfMeasure?: {
key?: string
id?: string
abbreviation?: string
numberOfDecimalPlaces?: number
isBase?: false | true
parent?: { key?: string; id?: string; href?: string }
conversionFactor?: number
href?: string
audit?: {
createdDateTime?: string
modifiedDateTime?: string
createdBy?: string
modifiedBy?: string
}
}[]
href?: string
audit?: {
createdDateTime?: string
modifiedDateTime?: string
createdBy?: string
modifiedBy?: string
}
} & { id?: {} }
) {
const url = new URL(
`https://api.intacct.com/ia/api/v1/objects/inventory-control/unit-of-measure-group/${key}`
)
const response = await fetch(url, {
method: 'PATCH',
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