Connecting to FreshBooks
To authenticate to FreshBooks, and connect to your own data or to allow other users to connect to their data, you can use the OAuth standard.
Using OAuth Authentication
FreshBooks uses OAuth 2.0 for authentication. To set up OAuth authentication with FreshBooks:
- Register a new application in your FreshBooks Developer Dashboard
- Configure the redirect URI to match your application's callback URL
- Note your Client ID and Client Secret from the app registration
- Set the required OAuth scopes based on the FreshBooks data you need to access
After setting the following connection properties, you are ready to connect:
- AuthScheme: Set this to OAuth.
- InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to manage the process to obtain the OAuthAccessToken.
- OAuthClientId: Set this to the client_id that is specified in your app settings.
- OAuthClientSecret: Set this to the client_secret that is specified in your app settings.
- CallbackURL: Set this to the redirect URL configured in your Freshbooks application.
Example connection string:
Profile=C:\profiles\FreshBooks.apip;AuthScheme=OAuth;OAuthClientId=YOUR_CLIENT_ID;OAuthClientSecret=YOUR_CLIENT_SECRET;InitiateOAuth=GETANDREFRESH;CallbackUrl=your_callback_url;
Usage Examples
Accounts:
SELECT * FROM Accounts WHERE BusinessUuid = '491ac4c1-7241-4550-8c55-533f9b68a201'
BillPayments:
SELECT * FROM BillPayments WHERE AccountId = 'BVjPYw'
Bills:
SELECT * FROM Bills WHERE AccountId = 'BVjPYw'
BillVendors:
SELECT * FROM BillVendors WHERE AccountId = 'BVjPYw'
Clients:
SELECT * FROM Clients WHERE AccountingSystemId = 'BVjPYw'
CreditNotes:
SELECT * FROM CreditNotes WHERE AccountingSystemId = 'BVjPYw'
CurrentUser:
SELECT * FROM CurrentUser
Estimates:
SELECT * FROM Estimates WHERE AccountingSystemId = 'BVjPYw'
ExpenseCategories:
SELECT * FROM ExpenseCategories WHERE AccountId = 'BVjPYw'
Expenses:
SELECT * FROM Expenses WHERE AccountingSystemId = 'BVjPYw'
Gateways:
SELECT * FROM Gateways WHERE AccountId = 'BVjPYw'
InvoiceProfiles:
SELECT * FROM InvoiceProfiles WHERE AccountingSystemId = 'BVjPYw'
Invoices:
SELECT * FROM Invoices WHERE AccountId = 'BVjPYw'
Items:
SELECT * FROM Items WHERE AccountingSystemId = 'BVjPYw'
JournalEntries:
SELECT * FROM JournalEntries WHERE AccountingSystemId = 'BVjPYw'
ManualJournalEntries:
SELECT * FROM ManualJournalEntries WHERE BusinessUuid='491ac4c1-7241-4550-8c55-533f9b68a201'
OtherIncome:
SELECT * FROM OtherIncome WHERE AccountId = 'BVjPYw'
PaymentOptions:
SELECT * FROM PaymentOptions WHERE AccountId = 'BVjPYw' AND invoiceid = '201609'
Payments:
SELECT * FROM Payments WHERE AccountingSystemId = 'BVjPYw'
Projects:
SELECT * FROM Projects WHERE BusinessId = '14201069'
ServiceRates:
SELECT * FROM ServiceRates WHERE BusinessId = '14201069' AND ServiceId = '26031356'
Services:
SELECT * FROM Services WHERE BusinessId = '14201069'
Systems:
SELECT * FROM Systems WHERE AccountId = 'BVjPYw' AND Id = '9728765'
Tasks:
SELECT * FROM Tasks WHERE AccountId = 'BVjPYw'
Taxes:
SELECT * FROM Taxes WHERE AccountingSystemId = 'BVjPYw'
TeamMembers:
SELECT * FROM TeamMembers WHERE BusinessId = '14201069'
TimeEntries:
SELECT * FROM TimeEntries WHERE BusinessId = '14201069'
Connection Properties
The connection string properties are the various options that can be used to establish a connection. This section provides a complete list of the options you can configure in the connection string for this provider.
| Property | Description |
| AuthScheme | The scheme used for authentication. Accepted entries are None or OAuth. Allowed values are: BASIC, NONE, NTLM, OAUTH, APIKEY, OAUTH_CLIENT |
| CallbackURL | Identifies the URL users return to after authenticating to API via OAuth (Custom OAuth applications only). |
| InitiateOAuth | Specifies the process for obtaining or refreshing the OAuth access token, which maintains user access while an authenticated, authorized user is working. Allowed values are: OFF, GETANDREFRESH, REFRESH |
| OAuthClientId | Specifies the client ID (also known as the consumer key) assigned to your custom OAuth application. This ID is required to identify the application to the OAuth authorization server during authentication. |
| OAuthClientSecret | Specifies the client secret assigned to your custom OAuth application. This confidential value is used to authenticate the application to the OAuth authorization server. (Custom OAuth applications only.). |