So, I came across a project for work where I had to work with the Freshbooks API. Instead of having users put in their “API URL” and “Authentication Token” everytime (by going to their Freshbooks > My Account > Freshbooks API), which was just inconvenient. I registered my app for Freshbooks OAuth use. Problem was, there wasn’t an great documentation on how to implement Freshbooks and OAuth calls. I tried authenticating with OAuth classes that were already built, but the problem was that Freshbooks expects an Authorization header and not Authorization posted to the body, as far as I could see. So, I read a blog entry on Formstack’s blog and started writing a Freshbooks API with OAuth class. I was able to get Authentication working and grab an access token, etc. but a problem lied where I couldn’t figure out how to send requests to Freshbooks API with an OAuth header. I contacted Michael Mattax ( @mmattax ) via email and he helped me out a little with a cURL function to send requests to Freshbooks API.
So, first off, after expanding the file available for download you’ll see and “index.php” and a folder “src” which contains: “freshbooks.php” and “config.php”.
** Updated October 1st, 2010
Continue reading Freshbooks API using OAuth