//native
type Pinterest = {
token: string;
};
/**
* Get ad
* Get a specific ad given the ad ID. If your pin is rejected, rejected_reasons will
contain additional information from the Ad Review process.
For more information about our policies and rejection reasons see the Pinterest advertising standards.
*/
export async function main(
auth: Pinterest,
ad_account_id: string,
ad_id: string,
) {
const url = new URL(
`https://api.pinterest.com/v5/ad_accounts/${ad_account_id}/ads/${ad_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