//native
type Pinterest = {
token: string;
};
/**
* Get Salesforce account details including bill-to information.
* Get Salesforce account details including bill-to information to be used in insertion orders process for ad_account_id.
- The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via Business Access: Admin, Finance, Campaign.
*/
export async function main(auth: Pinterest, ad_account_id: string) {
const url = new URL(
`https://api.pinterest.com/v5/ad_accounts/${ad_account_id}/ssio/accounts`,
);
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