//native
/**
* Update Account
* Updates attributes of an existing account (e.g. { "industry": "Manufacturing" }).
*/
export async function main(
auth: RT.Outreach,
account_id: number,
attributes: { [key: string]: any }
) {
const response = await fetch(
`https://api.outreach.io/api/v2/accounts/${account_id}`,
{
method: "PATCH",
headers: {
Authorization: `Bearer ${auth.token}`,
"Content-Type": "application/vnd.api+json",
Accept: "application/vnd.api+json",
},
body: JSON.stringify({
data: { type: "account", id: account_id, attributes },
}),
}
)
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 5 hours ago