The library is available from the Central Maven Repository and can be used easily by many tools including Maven, Gradle, SBT, etc.
<dependency>
<groupId>com.connectifier.xero</groupId>
<artifactId>client</artifactId>
<version>0.2</version>
</dependency>
Reader pemReader = new FileReader(new File("my-x509-cert.pem"));
XeroClient client = new XeroClient(pemReader, consumerKey, consumerSecret);
client.getInvoices();
- This library and all dependencies are available in the Maven Central Repository
- Work with standard Java classes like List<Invoice> and Date instead of ArrayOfInvoice and JAXBElement<GregorianCalendar>
- Easily extensible - protected, non-final client
Pull requests will be accepted for any not yet supported features. Changes to existing methods will be more likely to be accepted if a test is added. All fields in the XeroClient are protected to make it easy to extend in your own code without needing to update this client.
Many of the missing features here are due to Xero's own XML schema library being horribly out-of-sync with what their API returns. Please view the bug tracker on that project for limitations.
The only write call included thus far is for creating invoices because that's all we've needed. It's only a few lines to add a new write method if you find one that you need. However, this is another area where Xero's XML schemas are lacking, so you may have to submit a pull request to the Xero XML Schema project to be able to write new types as shown in this example and this example.
Error handling is not great because Xero's API is not conforming to their XML schema. See:
Support for attachments has not yet been added.
Currently, only the private app authentication method has been implemented. We use Scribe to support OAuth, so support for the public app OAuth should be straight forward to implement if needed.
The Gradle build tool must be installed and Xero's XML schema library must be checked out as a sibling project. Build with:
gradle compileJava
Note that you can only run via Gradle and not via an IDE. See the JiBX binding page for more details.
Also, a pending pull request to the Xero API XML schemas is required