Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Getting Started >

Using Xero.Api. references

Started by Accounts Department -   in Getting Started

I'm just getting started with Xero and I've cut and pasted some code from "PublicApplicationRunner" which uses the following assemblies reference:

using XeroApi.OAuth

There are a few other available but that's the only one that's needed.

The problem I have is with other samples I have looked at which use the following assembly references:

using Xero.Api.Infrastructure.Interfaces;
using Xero.Api.Infrastructure.OAuth.Signing;
using Xero.Api.Infrastructure.ThirdParty.Dust;

I do not have access to any of Xero.Api references.

Can anyone tell me how to get to them?

The quickest way is nuget packages. Unfortunately this is being phased out but the system will not change to much. The path is Xero.Api.Model for contacts etc. and Xero.Api.Repository for repo to connect

Kind Regards
Henzard Kruger
Certified Advisor and API developer
Picahoo cc - 0711304241 - henzard@picahoo.co.za

Henzard Kruger  

Thanks Henzard.
I've installed all the Xero nuget packages. There are 5 in total but I'm not being allowed to key in "using Xero.Api.Model" or .Repository.

I can key in "using XeroApi.OAuth" and .Linq


Accounts Department  

So I have access to the XeroApi references but not to Xero.Api references!!

Accounts Department  

Which sample C# code solution were you working off?

There are 2 .Net Wrappers Libraries, one is an older one (XeroApi) and the other a more recent one (Xero.Api).

References to (using Xero.Api...) such as:
using Xero.Api.Infrastructure.Interfaces;
using Xero.Api.Infrastructure.OAuth.Signing;
using Xero.Api.Infrastructure.ThirdParty.Dust
Require the more recent .Net Wrapper. (Please correct me if I'm wrong guys) I don't think this wrapper is on nuget yet - you would need to download this .Net Wrapper from github and reference the XeroApi project in that to allow using the above namespaces.

References to (using XeroApi...) such as:
Require the older version of the .Net Wrapper which can also be downloaded via nuget.

If you are working with just the older wrapper (which I'm assuming you are since you mentioned the 'PublicApplicationRunner' class) you shouldn't have any problems running it from scratch (and you shouldn't run into problems of having any Xero.Api... usings)

A very basic set up you could do is (from memory):
- Create a Xero acc (with a demo company).
- Create a public app.
- Create a new C# console project.
- Add reference to the single/main Xero .Net wrapper via Nuget.
- Copy the Program class from the github sample project,
- Copy the PublicApplicationRunner class from the github sample project.
- Update the ConsumerKey and the ConsumerSecret variables to contain your app's respective values.
- Run the project (and hope for the best?)

Serge P  

Hi Thanks,
OK I think need to download the newer version in that case. I presume I'd be wiser to use the new one?

I've done all of that very basic set up you've mentioned and it worked fine but what I really want to do is create an account or post a journal to the nominal ledger and I'm assuming I should really use the new api as it is the one supported.

I'm struggling at this point to see how to download it from github.

Any pointers?


James Borland  

I've downloaded the zip file of Xero-Api and then added a reference to Xero.Api.dll and that seems to have given me access to the xero.api references.
It seems to me I've down loaded a lot of stuff I don't really need so I'm a bit worried I'm on the wrong track.

I am presuming that everything I could do with XeroApi. references can now be done with Xero.Api. references ? Can someone confirm that?

Thanks for your help everyone.


Accounts Department  

New one is better than the old one. More optimized especially relationship between entities have been revised and it made my work very easy but if you have to convert your already written code from old to new, you have to do a lot of work because new wrapper(Xero.Api) is much different from old XeroApi. i have issues in switching my project from old api to new one. one of the issues is here

if its not much needed then try to manage code in old api that is already written in old api..


pak tech