FreshBooks API Guide

Archive for July, 2007

Symfony Plugin for the FreshBooks API

Thursday, July 19th, 2007

Symfony users rejoice: there’s now an easy-to-use plugin for integrating your Symfony applications with the FreshBooks API. In case you’re not familiar, Symfony is a web development framework for PHP:

… symfony aims to speed up the creation and maintenance of web applications, and to replace the repetitive coding tasks by power, control and pleasure.

Much appreciation to the author, Ian Ricketson, for sharing his work. In case you missed it, users have also contributed Ruby and Perl libraries.

FreshBooks, Ruby, and Rack

Monday, July 9th, 2007

If you’re a Ruby or Rails developer looking to get started with the FreshBooks API, I recommend taking a look at the latest sample code we’ve put together: invoice_getter.rb.

It uses FreshBooks.rb, a Ruby wrapper I’ve written, to fetch a particular invoice’s details and render it as HTML. A call to invoice.list populates a select box letting you choose from your last 25 invoices. It might be a useful starting point for businesses that want to customize and style their invoice formats.

For fun, I’ve coded invoice_getter.rb using Rack, the modular web server interface, so it can be either launched traditionally using Apache/CGI, or using Ruby’s WEBrick server. As a Rails enthusiast, I love working with WEBrick – you can quickly launch and re-start your app from the command-line, skipping the messiness of an Apache conf file.

If you’ve already got Ruby and RubyGems installed, you can quickly install Rack and launch invoice_getter.rb like so:

# gem install rack -–include-dependencies
...
Successfully installed rack-0.2.0
Installing ri documentation for rack-0.2.0…
Installing RDoc documentation for rack-0.2.0

# ruby invoice_getter.rb
[2007-07-09 10:50:34] INFO WEBrick 1.3.1
[2007-07-09 10:50:34] INFO ruby 1.8.6 (2007-03-13) [i386-mswin32]
[2007-07-09 10:50:34] INFO WEBrick::HTTPServer#start: pid =3944, port=3000

Now, fire up your web browser to http://localhost:3000 and you’re good to go.

In case you missed the link above, you can download the sample code here.

Sample Code: CSV to New Item

Tuesday, July 3rd, 2007

csv2item1.gif

If you have enabled the API for your system and are ready get started, I highly recommend checking out our sample code collection. If you have PHP installed on your server, I recommend experimenting with the API Tester file. It serves as an excellent testing tool to get started with the API. Furthermore, the code contains functions that you can reuse to create your own custom solutions.

I was able to create a quick program in less than an hour that imports items into your FreshBooks system from a comma delimited text with some small changes to the API Tester file.

FreshBooks API Blog