airbyte

Andrey Kozichev

Extracting Data from Xero with Airbyte!

Xero for Accountants

Xero is a cloud-based accounting software platform designed for small and medium-sized businesses (SMBs) and their advisors. It offers a range of accounting features, including invoicing, bank reconciliation, expense tracking, payroll processing, and reporting.

Accounting firms manage multiple clients and often need to access data from several cloud platforms. A typical scenario is for Xero users to provide data in CSV format for importing into accounting software.

This manual and tedious task can be easily replaced with an Airbyte job. Airbyte provides ready Xero connector that seamlessly pull data from various Xero APIs.


Xero for dev access

Before configuring the Airbyte connector, we need to create credentials to access the Xero API. If you don't have a Xero Account, it's straightforward to get one for free. Additionally, you can use their demo account, which already contains some data, for testing purposes.

Access to Xero API can be provided by creating new app in https://developer.xero.com/.

When creating a new app, copy the 'Client id,' a long string such as 'EBED467CD3……,' and generate a secret. Make a note of both as we will use them when configuring the Airbyte Connector.


Xero Airbyte Connector

To configure Xero Connector we will need the following information:

  • Client ID

  • Client Secret

  • Refresh Token

  • Access Token

  • Token Expiry Date

Client ID and Client Secret we already know, now we need to get remaining details.

The Xero Documentation provides a thorough explanation of the authentication flow. However, navigating it for the first time can be challenging.

We found the easiest way to get what we need is by using Insomnia, a free tool available for most modern operating systems.

  1. Using Insomnia create new request of type “GET”

  2. URL set to https://api.xero.com/connections

  3. For Authentication Method select OAuth2 and the rest of the configuration should be set as following

GRANT TYPE:        "Authorization Code"
AUTHORIZATION URL: "https://login.xero.com/identity/connect/authorize"
ACCESS TOKEN URL:  "https://identity.xero.com/connect/token"
CLIENT ID:         "our client id"
CLIENT SECRET:     "client secret"
REDIRECT URL:      "http://localhost"
SCOPE:             "openid email profile accounting.journals.read accounting.settings offline_access accounting.transactions"
STATE:             "can be anything"
CREDENTIALS:       "As Basic Auth Header"

It should looks something like this

In the above the SCOPE is an important element. This is what will define the limits of your access. Here we are using several scopes because we are looking to pull data from several Xero APIs. More information on Xero Scopes can be found in Developers Documentation.

Before we hit "Send" we need to go through the OAuth2 Flow by pressing "Fetch Token" button at the bottom of the window.

This will bring up a browser window and will ask us to authenticate with username and password. We need to do this every time the token expires. Alternative approach would be to use Xero premium option "Custom Connections".

After granting permissions your Insomnia window should look like this:

We can see Refresh and Access Tokens we can use for authentication.

Finally now we can hit a "Send" button. The response should contain the last useful piece of information you need - Tenant ID:

Now we have all information we needed to configure Xero Connector:

Now we can configure new Connection and start pulling Data from Xero APIs into our DataWarehouse.

Using a simple Airbyte job not only eliminates the need for manually passing CSV files between clients and accountants but also ensures that your data stays in sync automatically.

Using a simple Airbyte job not only eliminates the need for manually passing CSV files between clients and accountants but also ensures that your data stays in sync automatically.

Using a simple Airbyte job not only eliminates the need for manually passing CSV files between clients and accountants but also ensures that your data stays in sync automatically.

Andrey Kozichev

Subscribe for the latest blogs and news updates!

Related Posts

finance

Sep 4, 2024

For any financial organisation, being able to access all relevant client data quickly is not just a competitive advantage in the current market - it’s an absolute necessity for the company’s survival.

fivetran

Jun 11, 2024

Incremental sync and truncating the data in raw tables can improve the performance of your syncs.

© MetaOps 2024

© MetaOps 2024

© MetaOps 2024