//native
type SageIntacct = {
token: string
}
/**
* Get a line in a named document
* Returns detailed information for a specified purchasing document line. For example, to get a line within a document that is based on the PO Receiver Invoice transaction definition, specify `PO Receiver Invoice` for the `documentName` in the request URL.
Permissions and other requirements
SubscriptionPurchasing
User typeBusiness, Employee, Project Manager, Warehouse
PermissionsList, View Purchasing documents
*/
export async function main(auth: SageIntacct, documentName: string, key: string) {
const url = new URL(
`https://api.intacct.com/ia/api/v1/objects/purchasing/document-line::${documentName}/${key}`
)
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: 'Bearer ' + auth.token
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago