//native
type Attio = {
token: string;
};
/**
* Update a record (overwrite multiselect values)
* Use this endpoint to update people, companies, and other records by `record_id`. If the update payload includes multiselect attributes, the values supplied will overwrite/remove the list of values that already exist (if any). Use the `PATCH` endpoint to append multiselect values without removing those that already exist.
Required scopes: `record_permission:read-write`, `object_configuration:read`.
*/
export async function main(
auth: Attio,
object: string,
record_id: string,
body: { data: { values: {} } },
) {
const url = new URL(
`https://api.attio.com/v2/objects/${object}/records/${record_id}`,
);
const response = await fetch(url, {
method: "PUT",
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