//native
type SageIntacct = {
token: string
}
/**
* Create a location
* Creates a new location. You can think of this as adding a new value to the dimension that you can use to tag transactions for reporting.
Permissions and other requirements
SubscriptionCompany
User typeBusiness user with admin privileges
PermissionsAdd Location
*/
export async function main(
auth: SageIntacct,
body: {
key?: string
id?: string
href?: string
name?: string
status?: 'active' | 'activeNonPosting' | 'inactive'
taxId?: string
startDate?: string
endDate?: string
contacts?: {
primary?: {
key?: string
id?: string
href?: string
lastName?: string
firstName?: string
middleName?: string
prefix?: string
printAs?: string
email1?: string
email2?: string
phone1?: string
phone2?: string
mobile?: string
pager?: string
fax?: string
URL1?: string
URL2?: string
companyName?: string
mailingAddress?: {
addressLine1?: string
addressLine2?: string
addressLine3?: string
city?: string
state?: string
postCode?: string
country?: string
}
} & {}
shipTo?: {
key?: string
id?: string
href?: string
lastName?: string
firstName?: string
middleName?: string
prefix?: string
printAs?: string
email1?: string
email2?: string
phone1?: string
phone2?: string
mobile?: string
pager?: string
fax?: string
URL1?: string
URL2?: string
companyName?: string
mailingAddress?: {
addressLine1?: string
addressLine2?: string
addressLine3?: string
city?: string
state?: string
postCode?: string
country?: string
}
} & {}
}
locationReportingTitle?: string
parent?: { key?: string; id?: string; href?: string; name?: string }
manager?: { key?: string; id?: string; href?: string; name?: string }
audit?: {
createdDateTime?: string
modifiedDateTime?: string
createdBy?: string
modifiedBy?: string
}
} & {}
) {
const url = new URL(`https://api.intacct.com/ia/api/v1/objects/company-config/location`)
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