Log in
 

API examples

C# using VS2010

WSDL to use, added as a service reference not web reference.

Initialisation

//The client object
cb.Clearbooks_Service_ApiPortClient client = new cb.Clearbooks_Service_ApiPortClient();
 
//The apiKey object
cb.authenticate auth = new cb.authenticate();
auth.apiKey = "YOUR_API_KEY";

CreateInvoice

private void button1_Click(object sender, EventArgs e)
{
//The client object
cb.Clearbooks_Service_ApiPortClient client = new cb.Clearbooks_Service_ApiPortClient();
 
//The apiKey object
cb.authenticate auth = new cb.authenticate();
auth.apiKey = "YOUR_API_KEY";
 
//A single invoice
cb.Invoice invExample = new cb.Invoice();
 
invExample.dateCreated = "2012-01-24";
invExample.dateDue = "";
invExample.description = "My C# test invoice";
invExample.reference = "1234";
invExample.type ="purchases";
invExample.entityId = 1;
 
cb.Item line = new cb.Item();
line.description ="Standard Monthly Plan 15 inc VAT";
line.unitPrice = (float) 12.0;
line.quantity = (int) 12.0;
line.type =2001003;
line.vatRate = "0.2";
 
invExample.items = new cb.Item[1];
invExample.items[0] = line;
 
richTextBox1.AppendText("Request Start");
 
//Creating an invoice using a call to the client
cb.Invoice response = client.createInvoice(auth, invExample);
 
richTextBox1.AppendText("Request Complete");
}
ICB accreditation

Clear Books, accredited by The Institute of Certified Bookkeepers and registered with the Financial Conduct Authority (reg. no. 843585), delivers valued, comprehensive online accounting software for small businesses in the UK.