GnuCash API

Neil Williams linux at
Mon Jan 31 14:20:40 EST 2005

On Monday 31 January 2005 4:22 pm, Russell Sutherland wrote:
> * Derek Atkins (warlord at MIT.EDU) [31 Jan 2005 10:41]:
> > You probably want to wait until Neil finishes his QSF work -- his goal
> > is exactly yours -- to be able to import invoices into GnuCash.

Yes, see my reference pages for the beginnings of the API for this:
Especially the sections on QSF.

I'm working via pilot-link but if there is an application that you want to use 
to create the XML version of the invoice, it can be supported if you use the 
same techniques to wrap QOF around the application objects. I'm in the 
process of writing a HOWTO for that technique.

QSF also supports hand-edited XML but that raises more problems for the 
automation unless you are meticulous about copying existing GUID references.

I don't see why a simple command line tool cannot be created to write the QSF 
XML from other input. However, that is left as an exercise for the reader.

In theory, it's a simple matter of programming to make this into a data stream 
rather than relying on files, to allow for online imports. That is certainly 
a goal of the pilot-link work.

> > It's 
> > unlikely you'll be able to do it without some amount of user
> > intervention, however, so a crontab may not be reasonable.

Exactly. I am hoping for as much automation as possible but although that may 
well be possible with the QSF portion, the invoice will always have to be 
merged into your existing data. This will require making sure that the 
customer referenced in the invoice actually exists, (and handling conflicts 
of customers that are *almost* the same), making sure that the accounts that 
are debited and credited by the invoice entries exist (and what to do if they 
don't), actually checking that the invoice - as created - is a true 
reflection of the real event before posting it to the CoA (that's a human 
intervention issue that simply won't go away).

> Just to be clear and to make sure we're talking about the
> same thing. I want to be able to insert all the data to create
> a new invoice

into XML and merge that into your existing GnuCash data

> and then print it or (preferrably) email mail 
> it out to the customer.

You can use the Customer report for that.

> I envision a commandline program 
> that encodes all the information as arguments.

It is FAR more complex than that!

It won't need a command line program to load it into GnuCash, it will be part 
of GnuCash (the g2 branch, when released). There will be a File -> Import 
menu command to load the relevant QSF XML file containing the data that you 
need. This will load the merge code to complete the process.

There'll be an API for online communication direct from a GnuCash menu option 
that will be used to interface directly with pilot-link - whatever process 
you use to create the QSF data can use the same API when it is ready.


Neil Williams

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :

More information about the gnucash-devel mailing list