Hello, I am working with the Sage Accounting API.
I am trying to get the full data for businesses under my test Sage account using this Axios request in Node.
https://developer.sage.com/api/accounting/api/user-businesses/#tag/Businesses
const response = await axios.get(
'https://api.accounting.sage.com/v3.1/businesses',
{
headers: { 'Authorization': `Bearer ${accessToken}` }
}
)
.catch(function (error) {
console.log('error getting businesses', error.response.data);
res.json({ error: 'error getting businesses' })
})
console.log('businesses DATA!', response.data)
const { $items } = response.data;
Unfortunately, these are the only results I get...
{
"$total": 1,
"$page": 1,
"$next": null,
"$back": null,
"$items_per_page": 2147483647,
"$items": [
{
"displayed_as": "test1",
"id": "dd9b41c0acb5493bab7d01dee779e716",
"$path": "/businesses/dd9b41c0acb5493bab7d01dee779e716"
}
]
}
The account that holds the business is under a Sage Business Cloud Accounting 30-Day Free Trial subscription.
Also, I noticed that addressing the specific business by ID returns the full data of the business.
{
"created_at": "2022-04-05T09:37:58Z",
"updated_at": "2022-04-05T09:37:58Z",
"displayed_as": "test1",
"id": "dd9b41c0acb5493bab7d01dee779e716",
"name": "test1",
"address_line_1": "some address",
"address_line_2": null,
"city": "some town",
"postal_code": "92618",
"country": {
"id": "US",
"displayed_as": "United States"
},
"region": "NE",
"ni_based": false,
"telephone": "11111",
"mobile": "232",
"website": null,
"is_demo": false,
"subscriptions": [
{
"created_at": "2022-04-05T09:37:59Z",
"updated_at": "2022-04-05T09:38:00Z",
"displayed_as": "Accounting",
"id": "ACCOUNTING",
"active": true,
"status": "trial",
"accountant_pays": false
}
],
"$path": "/businesses/dd9b41c0acb5493bab7d01dee779e716",
"user_roles": [
"business_owner",
"system_manager"
],
"user_permissions": [
{
"area": "accounting_sales",
"role": "full_access"
},
{
"area": "accounting_catalogs",
"role": "full_access"
},
{
"area": "accounting_journals",
"role": "full_access"
},
{
"area": "accounting_purchases",
"role": "full_access"
},
{
"area": "accounting_contacts",
"role": "full_access"
},
{
"area": "accounting_statutory_reporting",
"role": "full_access"
},
{
"area": "accounting_bank",
"role": "full_access"
},
{
"area": "accounting_reporting",
"role": "full_access"
},
{
"area": "accounting_settings",
"role": "full_access"
}
]
}
Can someone please advise on what's going on here?