FreshBooks

Search


API Calls

Resources

Eating our own dog food

by Diana Clarke on November 11, 2009

About a year ago, we started to really focus on what the future of development at FreshBooks would look like.

Aside from the obvious concerns about code quality and maintainability, we had an additional requirement to keep in mind: integrations! We integrate with tons and tons of other applications, so while FreshBooks the web application is still our flagship, we needed to stop developing from its point of view, and embrace that fact that our web application is just one of many FreshBooks data consumers. We needed to start eating our own dog food.

The mantra is simple — anything we develop for FreshBooks the web application should also be, by definition, available for third parties to consume. To accomplish this, we are in the process of decoupling our web application from the database/business logic, and instead consuming a new FreshBooks API called Evolve1. Since our own application is driving the requirements, the resulting API is more complete and performant than previous passes. I look forward to the day when I can announce Evolve's public debut, but for now it's strictly internal.

Stay tuned for more technical details and a series of posts on how we got here. In the mean time, I'll close with a quick example of FreshBooks eating its own dog food to render a capacity meter by calling out to Evolve for the data it needs. The new API is a RESTful one that supports serialization in both XML and JSON. It's written in Python and uses Pylons and SQLAlchemy — there's a bunch we could discuss there.

The capacity meter on the documents tab.


$ curl -u [auth] https://[evolve]/documents/capacities.json
{
  "response": {
    "result": {
      "capacity": {
        "available": 0.34,
        "size": 2.0,
        "unit": "MB",
        "used": 1.66
      }
    }
  }
}

$ curl -u [auth] https://[evolve]/documents/capacities.xml
<response>
  <result>
    <capacity>
      <unit>MB</unit>
      <size>2.0</size>
      <available>0.34</available>
      <used>1.66</used>
    </capacity>
  </result>
</response>

Evolve went into production a couple of weeks ago, quietly ripping the backend out of our web application, one data silo at a time. I'm proud. What do you think? Feedback? Questions?

1Nope, not implying that we were Neanderthals before -- I name all my apps after Ani Difranco.

Comments

Geoffrey Wiseman
November 11, 2009

Nice to see this happening.  Should end up being a good case study for evolving a codebase in place.

Michael McGovern
November 15, 2009

If I haven’t yet started to program against the API and it isn’t an urgency I do so, will I be better off waiting until Evolve has evolved?

Diana Clarke
November 16, 2009

When the time comes, do what’s best for your business with the options available, and we’ll be there to support you.

I don’t yet know what we’ll do with the current API, but I do know we won’t just all of a sudden abandon it.

Perhaps the old API will simply become a consumer of Evolve unbeknownst to its current consumers. Not sure yet.

Thanks for stopping by, Michael.

—diana

Sunir
November 24, 2009

Hey Michael, I’m the head of integrations at FreshBooks. Let me clarify one thing. The existing API will be the only public API for a long, long time. The smart bet is to use what we got because it’s very well supported.

If we ‘evolve’ the API, it will be to create a completely new API suitable for new environments, such as Google Wave or the Interplanetary Internet (http://www.ipnsig.org) in case we want to expand to the lucrative Martian market.

Cheers,
Sunir, Chief Handshaker, FreshBooks

Merrick Christensen
December 4, 2009

I wish you knew how much I love FreshBooks for these reasons.

Add your own comment

Full Name *
Email Address *
URL
Comment *
Captcha*
Please enter the word you see in the image below