Skip to content

Instantly share code, notes, and snippets.

@j-norwood-young
Last active January 27, 2020 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j-norwood-young/47976905a66eb75ee16ffbda17e2be58 to your computer and use it in GitHub Desktop.
Save j-norwood-young/47976905a66eb75ee16ffbda17e2be58 to your computer and use it in GitHub Desktop.
Retrieve all tenants from Xero
const tenants = (await axios.get("https://api.xero.com/connections", {
headers: {
"Authorization": `Bearer ${ exchange.data.access_token }`
}
})).data;
for(let tenant of tenants) {
let organisation = (await axios.get(`https://api.xero.com/api.xro/2.0/Organisation`, {
headers: {
Authorization: `Bearer ${exchange.data.access_token}`,
"xero-tenant-id": tenant.tenantId
}
})).data.Organisations[0];
tenant.name = organisation.Name;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment