//native
type SageIntacct = {
token: string
}
/**
* Create a unit of measure group
* Creates a new custom unit of measure group.
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, Add Unit of Measure groups
*/
export async function main(
auth: SageIntacct,
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
}
} & {} & { defaults?: {} }
) {
const url = new URL(
`https://api.intacct.com/ia/api/v1/objects/inventory-control/unit-of-measure-group`
)
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