Skip to content

Instantly share code, notes, and snippets.

@XeroAPI
XeroAPI / gist:1234181
Created September 22, 2011 06:27
Sample code to show capturing a validation error in the XeroAPI.Net wrapper library
// Try and create an invoice - but using incorrect data. This should hopefully be rejected by the Xero API
Invoice invoiceToCreate = new Invoice
{
Contact = contact,
Type = "ACCREC",
Date = DateTime.Today,
LineItems = new LineItems
{
new LineItem
{
@XeroAPI
XeroAPI / gist:1234145
Created September 22, 2011 05:47
Invoice Xml with ContactID
<Invoice>
<Type>ACCREC</Type>
<Contact>
<ContactID>8fbad9ef-d451-447e-ba2b-5bccc10acd9f</ContactID>
</Contact>
<Date>2011-09-22</Date>
...
</Invoice>
@XeroAPI
XeroAPI / gist:1119628
Created August 2, 2011 04:54
XeroAPI.Net Mini App
static void Main(string[] args)
{
IOAuthSession session = new XeroApi.OAuth.XeroApiPrivateSession(
"XeroAPI Mini App",
"YOUR-CONSUMER-KEY",
new X509Certificate2(@"D:\Your-Certificate.pfx", "your-pfx-password"));
Repository repository = new Repository(session);
Console.WriteLine("You're connected to " + repository.Organisation.Name);
@XeroAPI
XeroAPI / gist:926352
Created April 18, 2011 22:18
Invoices showing Contacts with ContactNumber
<Invoices>
<Invoice>
<Contact>
<ContactID>aacecb74-ef1e-44e0-ba52-0bc521639697</ContactID>
<ContactNumber>C290348</ContactNumber>
<Name>PC Complete</Name>
</Contact>
...
</Invoice>
</Invoices>