0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Datamodel】Try using Sharperlight XERO Datamodel

Posted at

Introduction

I try to use Sharperlight XERO datamodel to sync data from XERO Accounting Software.
image.png
What I need are;

I think that's all so let's start setting up one by one.

Setup

XERO Developer Account

Start from here
I sign up as I don’t have a developer account. If you have the one, please just login with your account.
image.png

XERO App

When I login to my account, I am taken to this page. I click New app button to start creating my own XERO application.
image.png
The page shown below is displayed.
image.png
I set App name, Company or application URL and Redirect URI.
Redirect URI I entered is used when accessing to XERO API later so take a memo of it.
Click Create app button to create it.

I am taken to this page.
image.png
I can see what I entered when I created this App with App details from the menu on the left.
image.png

I move to Configuration I can get all information for accessing to the API from here.
They are Redirect URI, Client ID and Client Secret you can generate.
We need to keep those 3 items in a safe place for further use.
image.png

Sharperlight

I have Sharperlight installed on my PC so skip it.
FYI: Installation – Quick Guide

Sharperlight XERO Datamodel

This is the core object required I need to pull data from XERO API with Sharperlight.
I can download SLXERO.meta from here

Installation of the datamodel

Go for Sharperlight Application Menu, and select Datamodel Installer.
image.png
Once it is started, use Add button and browse the downloaded datamodel meta file to import it.
Click Finish button to close. It kicks in for compiling the datamodel.
image.png

Microsoft SQL Database

Sharperlight System database has to be in Microsoft SQL Server so it should be already there as I have Sharperlight installed already.
Let's open SQL Management Studio and go for the database server.
Create an empty database for XERO like this. The database name is whatever you want.
image.png

Making the connection between Sharperlight and the local XERO database

Sharperlight will communicate with the local XERO database via the XERO datamodel.

Open Sharperlight Client Setup.
Configure the database connection details for XERO datamodel.
Make sure the details are right with Test button.
image.png

Making the connection between Sharperlight and XERO API

Sharperlight will also communicate with the XERO API via the XERO datamodel.

When you have e.g. 5 organisations, you have to repeat the following steps in this section 5 times to register all 5 organisations to your XERO App.

Open Sharperlight Client Setup.
Choose the database connection for XERO Accounting Software.
Click Setup button.
image.png

The Setup application UI is opened like this.
image.png

Set Client ID, Client Secret and Redirect URI to their textboxes. When those three textboxes are filled in, Get User Authorized button gets enabled.
image.png

Click Get User Authorized button and I will be taken to the XERO login page.
image.png
Once I am authorized to login, I am taken to this page where I can choose which organisation I can add to my app.
I have only one (Demp Organisation) at this time, so it is already selected so click Allow access button.
image.png
I am taken to this page next. Copy the whole URL address to the clipboard.
image.png
Go back to XERO Setup UI and paste the URL address to the box at Step 2.
Then click Get Access Token / Organisations.
image.png
image.png

Click Close to finish, and also click OK to close Client Setup.
image.png

I think the setup has all done here.

Synchronisation

Let's try to sync data with XERO API.

Sharperlight Service

Open Windows Service Manager.
Choose Sharperlight Service, and click Restart or Start.
image.png

Sharperlight XERO Management Dashpage

Open Sharperlight Solutions from the Sharperlight Application Menu.
Right-click on Homepage under XERO Account Software, and click Execute.
image.png
Then I am taken to the homepage.
image.png

There are some restrictions to execute some menu items on this page without Sharperlight license.

Syncing Data

Click Synchronisation on Demand button.
image.png
I am taken to this page.
Click Sync button of Sync All though there is only one organisation.
image.png
Click OK on the confirmation dialog.
image.png
Then the Sync process is kicked in.
image.png
When the process is finished, I can see the its finish time and duration.
Click the left-arrow icon to go back to the home page.
image.png
I can see the total record number for each table on the home page.
I am also noticed that there is no error as Error count shows 0.
image.png

I can now make a query to see the data.
Open Query Bulder from the Sharperlight Application Menu.
Create the following query.
image.png
Preview it, I can see data which is sysnced with XERO API.
image.png

Conclusion

It is interesting solution with the cloud accounting software. We can make a local copy of data set and can create any types of reports over it.
It supports Delta Updates so once all data synced initially, it syncs just new or updated data only from then.
By using Sharperlight Scheduler, we can sync data every day at the time we decide.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?