//native
type Pinterest = {
token: string;
};
/**
* Delete ads data for ad account in API Sandbox
* Delete an ad account and all the ads data associated with that account.
A string message is returned indicating the status of the delete operation.
Note: This endpoint is only allowed in the Pinterest API Sandbox (https://api-sandbox.pinterest.com/v5).
Go to /docs/developer-tools/sandbox/ for more information.
*/
export async function main(auth: Pinterest, ad_account_id: string) {
const url = new URL(
`https://api.pinterest.com/v5/ad_accounts/${ad_account_id}/sandbox`,
);
const response = await fetch(url, {
method: "DELETE",
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