Woot! / QuickBooks Is a Royal Pain

So, I’m trying to write some code that will talk to QuickBooks. All I want to do for the moment is enter some test data in the weekly time sheets area. There’s an SDK, many code samples, and loads of documentation. It shouldn’t be that hard right? Ha!

To start with I don’t really like QuickBooks. It’s slow, it’s ugly, and the non standard widgets barely work. And I’ve tried, unsuccessfully, to work with the SDK before. So I knew this wasn’t going to be that simple. I already knew that QuickBooks actually had to be running and there was some security stuff.

Anyway here’s my code that will simply open the file and enter some time:

[Test]
public void TestEnterTime()
{
	RequestProcessor2 rp = new RequestProcessor2();
	rp.OpenConnection2("", "IDN CustomerAdd C# sample", QBXMLRPConnectionType.localQBD);
	string ticket = rp.BeginSession("C:\Documents and Settings\david\Desktop\Widgets Inc.QBW", QBFileMode.qbFileOpenDoNotCare);
	string response = rp.ProcessRequest(ticket, "< ?xml version="1.0"?>" +	// the < ?xml line is required!
		"" +
		"" +
		" " +
		"  " +
		"   " +
		"    2006-04-28" + // CCCC-MM-DD, 0 padded
		"    David Hogue" +
		"    test2" +
		"    test" +
		"    PT0H30M" +
		"   " +
		"  " +
		" " +
		"");
	rp.CloseConnection();
	Assert.IsFalse(response.Contains("error"), response);
}

Even though there is tons of documentation, it isn’t clear what syntax the api wants. There is a validator, but I had many times where my code validated correctly and QB didn’t like it. (It gave me a useless “error parsing xml” message). Finally I figured out that the < ?xml version="1.0"?> line is required.

Once I added the top line it gave me some more errors. Errors such as the record must be locked before it can be edited (translation: close the time entry window), a customer must be specified to enter billable time, etc.

Their COM based API is also very odd. It has a hundred or so enumerations, a couple hundred interfaces, and two or three public classes. Everything is created with factory methods. You can’t set any properties equal to a value, there’s always a SetValue method that takes a string. Not very .netified.

I don’t think many people are really using the SDK. I only found a few hits on google for common errors and peices of the xml like TimeTrackingAddRq. I predict that I’ll be in the top few results by next week.

Posted in Software Development and tagged . Permalink.

4 Responses to Woot! / QuickBooks Is a Royal Pain

  1. Is this with .net 1.1 or .net 2.0? Thanks!

    Stuart
  2. This was in 1.1. I imagine it would work in 2.0.

    The tough part was getting was getting the xml just right. qb was incredibly picky and didn’t give any useful error messages.

  3. Quickbooks sdk documentation is a joke at very best. Congrats on making to the first page of google. I love programming blindly and not being able to talk to anyone about it.

    Erik
  4. I’ve managed to get our Delphi apps passing invoice and timesheet back and forth via the QuickBooks API, but it was a lot of trial and error. It’s very odd that QB provides a full-featured, powerful API with good, low level (interface) documentation but practically zero high level documentation, examples or support. Their support forums are a lonely place where very few questions get answered.

    My guess is that perhaps .01% of QB users take advantage of the API and it’s in place mainly for internal testing and for third party developers who can devote a lot of time to learningit. The rest of us are on our own.

    Jeff

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>