type Apollo = {
apiKey: string;
};
export async function main(
resource: Apollo,
accountId: string,
updateData: {
name?: string;
domain?: string;
phone_number?: string;
}
) {
const endpoint = `https://api.apollo.io/v1/accounts/${accountId}`;
const body = updateData;
const response = await fetch(endpoint, {
method: "PUT",
headers: {
"Content-Type": "application/json",
"Cache-Control": "no-cache",
"X-Api-Key": resource.apiKey,
},
body: JSON.stringify(body),
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data.account;
}
Submitted by hugo697 181 days ago
type Apollo_io = {
apiKey: string
}
export async function main(
resource: Apollo_io,
accountId: string,
updateData: {
name?: string
domain?: string
phone_number?: string
}
) {
const endpoint = `https://api.apollo.io/v1/accounts/${accountId}`
const body = updateData
const response = await fetch(endpoint, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'Cache-Control': 'no-cache',
'X-Api-Key': resource.apiKey
},
body: JSON.stringify(body)
})
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}
const data = await response.json()
return data.account
}
Submitted by hugo697 181 days ago