//native
type Pinterest = {
token: string;
};
/**
* Get lead form by id
* This feature is currently in beta and not available to all apps, if you're interested in joining the beta, please reach out to your Pinterest account manager.
Gets a lead form given it's ID. It must also be associated with the provided ad account ID.
For more, see Lead ads.
*/
export async function main(
auth: Pinterest,
ad_account_id: string,
lead_form_id: string,
) {
const url = new URL(
`https://api.pinterest.com/v5/ad_accounts/${ad_account_id}/lead_forms/${lead_form_id}`,
);
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 536 days ago