Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Getting Started >

Establishing the connection between Private app and Xero

Started by Steven Hollander -   in Getting Started

Hi all,
OK i have registered a private app with Xero and been able to generate a xero key and secret.
I now need my program to create the xml code to retrieve from xero all contacts (customers) that start with the letter 'a'.
Our program (written in VBA) and currently does this with qbooks by

1. Establishing a connection with QBooks
Set qbXMLRP = CreateObject("QBXMLRP.RequestProcessor")
qbXMLRP.OpenConnection "", "DBS"

2. writing the xml (xmldoc) to a text file and then submitting the text file
strXML =
"<?xml version=""1.0""?><?qbxml version=""" & GetQBXMLVersion & """?>" & vbCrLf & _
"<QBXML>" & vbCrLf & _
"<QBXMLMsgsRq onError=""stopOnError"">" & vbCrLf & _
"<CustomerQueryRq requestID=""0"">" & vbCrLf & _
"<NameRangeFilter>" & vbCrLf & _
"<FromName>" & aFromName & "</FromName>" & vbCrLf & _
"<ToName>" & aToName & "</ToName>" & vbCrLf & _
"</NameRangeFilter>" & vbCrLf & _
"</CustomerQueryRq>" & vbCrLf & _
"</QBXMLMsgsRq>" & vbCrLf & _

3. Posting the xml into QBooks
4. opening the reposnse file, retrieveing the contents for the results that we require.

I need to do a similar thing with Xero but I need some direction in how to get started.
Looking at the samples provided on the web pages I can see the format of the xml to ask the question (get) etc but I do not

understand how to extablish the connection(in the above example qbXMLRP) and then pass the xml to Xero.
Also will the results be written to a text file to be opened by my program to extract the needed bits of info?

Thanks for your help.
Hi Steven,
Are you able to retrieve requestToken to connect to the xero API using a private application?If so what was your configuration seetings as i can't get mine to work :(

CRM Connector  

Hi CRM connector,
No I have not got that far because I do not understand how the info is passed back to my app etc. I am finding it a bit frustrating to get this interface going because I am getting very little feedback from Xero.
I realise that this must be pretty basic stuff to them but if I don't understand the interface at this level how can I proceed to the next level?

Steven Hollander  

I emailed the following to the Xero support team. They suggested that I post it here too so here goes......

Thanks for the link to Dan Barret’s code.
Looking at the code I feel I should understand what is happening but I don’t. I feel a bit like a German speaker listening to people speaking Danish.

The application will be private so
If I understand it correctly I should using the code in program.vb and PrivateApplicationRunner.vb

Running program.vb calls PrivateApplicationRunner.vb to establish the credentials of the process and create a repository (or shell). The program then uses the repository to pass the request to xero and receive the result of the request.

Ok The code examples provided by Dan are in VB. VB has the ability to create objects via ‘Imports’ statements. I don’t think that there is a comparible way of doing this in VBA unless we can set and object like
Set qbXMLRP = CreateObject("QBXMLRP.RequestProcessor")
qbXMLRP.OpenConnection "", "DBS"
( Where QBXMLRP is a quickbooks dll).

So I am unsure where to go from here.
Any hints would be greatfully appreciated.
Steven Hollander

Steven Hollander  

Why is it not possible, to just get a dll (or whatever executable) that I can link into my App. This would make the authentication for us. With the help of some reasonable functions. Our interface would just be a set of functions, with properly described parameters. That would do the trick for almost everybody (in the windows community of course :) ).
By the way, this works excellent with my SMS service provider.

Walter Gith  

Steven, did you make any progress with this?
We're in exactly the same boat, trying to switch Quickbooks connection for Xero in VBA here.

Brad Stevens  

Hi Brad,
It has been hard going but we have made progress. We have been able to post and retrieve contacts from the Xero database. We are now working on posting unconfirmed invoice to Xero.

Steven Hollander  

Anybody out there that is in the stage to provide a .dll that I can link into my VB app?

Walter Gith  

Hi Walter,
That is what we are working on. We are creating a dll that we can use from within MS Access (VBA) to send and retrieve data to Xero. So far so good.

Steven Hollander  

Sounds good. Any plans to market it?

Walter Gith  

Hi Walter,
Hmm... something we were talking about earlier today.
We have been working on this now for over a month (solid).
We will more than likely make it available as a dll for a small charge.
Still a bit of work to be done.
Will keep you posted.

Steven Hollander  


Walter Gith  

Interesting... how's the connection DLL progressing?

David Scott