Resources

Accounting

class freshbooks.api.accounting.AccountingResource(client_config, accounting_path, single_name, list_name, delete_via_update=True, missing_endpoints=None)

Handles resources under the /accounting endpoints.

create(account_id, data, includes=None)

Create a resource.

Args: account_id: The alpha-numeric account id data: Dictionary of data to populate the resource builders: (Optional) IncludesBuilder object for including additional data, sub-resources, etc.

Returns: Result: Result object with the new resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

delete(account_id, resource_id)

Delete a resource.

Note: Most FreshBooks resources are soft-deleted, See FreshBooks API - Active and Deleted Objects

Args: account_id: The alpha-numeric account id resource_id: Id of the resource to delete

Returns: Result: An empty Result object.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

get(account_id, resource_id, includes=None)

Get a single resource with the corresponding id.

Args: account_id: The alpha-numeric account id resource_id: Id of the resource to return builders: (Optional) IncludesBuilder object for including additional data, sub-resources, etc. Returns: Result: Result object with the resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

headers(method)

Get headers required for API calls

Return type

:py:class:~typing.Dict``[:py:class:``str, :py:class:str]

list(account_id, builders=None)

Get a list of resources.

Args: account_id: The alpha-numeric account id builders: (Optional) List of builder objects for filters, pagination, etc.

Returns: ListResult: ListResult object with the resources response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.ListResult

update(account_id, resource_id, data, includes=None)

Update a resource.

Args: account_id: The alpha-numeric account id resource_id: Id of the resource to update data: Dictionary of data to update the resource to builders: (Optional) IncludesBuilder object for including additional data, sub-resources, etc.

Returns: Result: Result object with the updated resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

Auth

class freshbooks.api.auth.AuthResource(client_config)

Handles resources under the /auth endpoints.

headers(method)

Get headers required for API calls

Return type

:py:class:~typing.Dict``[:py:class:``str, :py:class:str]

me_endpoint()

Get the identity details of the currently authenticated user.

See FreshBooks API - Business, Roles, and Identity

Returns: Result: Result object with the authenticated user’s identity and business details.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Identity

Projects

class freshbooks.api.projects.ProjectsResource(client_config, list_resource_path, single_resource_path, list_name=None, single_name=None, missing_endpoints=None)

Bases: freshbooks.api.projects.ProjectsBaseResource

Handles resources under the /projects endpoints.

create(business_id, data)

Create a resource.

Args: business_id: The business id data: Dictionary of data to populate the resource

Returns: Result: Result object with the new resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

delete(business_id, resource_id)

Delete a resource.

Note: Most FreshBooks resources are soft-deleted, See FreshBooks API - Active and Deleted Objects

Args: business_id: The business id resource_id: Id of the resource to delete

Returns: Result: An empty Result object.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

get(business_id, resource_id)

Get a single resource with the corresponding id.

Args: business_id: The business id resource_id: Id of the resource to return Returns: Result: Result object with the resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

list(business_id, builders=None)

Get a list of resources.

Args: business_id: The business id builders: (Optional) List of builder objects for filters, pagination, etc.

Returns: ListResult: ListResult object with the resources response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.ListResult

update(business_id, resource_id, data)

Update a resource.

Args: business_id: The business id resource_id: Id of the resource to update data: Dictionary of data to update the resource to

Returns: Result: Result object with the updated resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

Comments

class freshbooks.api.comments.CommentsResource(client_config, list_resource_path, single_resource_path, list_name=None, single_name=None, missing_endpoints=None)

Bases: freshbooks.api.projects.ProjectsResource

Handles resources under the /comments endpoints.

These are handled identically to /projects endpoints. Refer to freshbooks.api.projects.ProjectsResource.

create(business_id, data)

Create a resource.

Args: business_id: The business id data: Dictionary of data to populate the resource

Returns: Result: Result object with the new resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

delete(business_id, resource_id)

Delete a resource.

Note: Most FreshBooks resources are soft-deleted, See FreshBooks API - Active and Deleted Objects

Args: business_id: The business id resource_id: Id of the resource to delete

Returns: Result: An empty Result object.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

get(business_id, resource_id)

Get a single resource with the corresponding id.

Args: business_id: The business id resource_id: Id of the resource to return Returns: Result: Result object with the resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

headers(method)

Get headers required for API calls

Return type

:py:class:~typing.Dict``[:py:class:``str, :py:class:str]

list(business_id, builders=None)

Get a list of resources.

Args: business_id: The business id builders: (Optional) List of builder objects for filters, pagination, etc.

Returns: ListResult: ListResult object with the resources response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.ListResult

update(business_id, resource_id, data)

Update a resource.

Args: business_id: The business id resource_id: Id of the resource to update data: Dictionary of data to update the resource to

Returns: Result: Result object with the updated resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

class freshbooks.api.comments.CommentsSubResource(client_config, list_resource_path, single_resource_path, single_resource_sub_path=None, list_name=None, single_name=None, missing_endpoints=None)

Bases: freshbooks.api.projects.ProjectsBaseResource

Handles sub-resources under the /comments endpoints.

Eg. /comments/business/{business_id}/services/{service_id}/rate

These are handled similarly to /projects endpoints. Refer to freshbooks.api.projects.ProjectsResource.

create(business_id, resource_id, data)

Create a resource.

Args: business_id: The business id resource_id: Id of the parent resource to create this resource under data: Dictionary of data to populate the resource

Returns: Result: Result object with the new resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

delete(business_id, resource_id)

Delete a resource.

Note: Most FreshBooks resources are soft-deleted, See FreshBooks API - Active and Deleted Objects

Args: business_id: The business id resource_id: Id of the resource to delete

Returns: Result: An empty Result object.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

get(business_id, resource_id)

Get a single resource with the corresponding id.

Args: business_id: The business id resource_id: Id of the resource to return Returns: Result: Result object with the resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

headers(method)

Get headers required for API calls

Return type

:py:class:~typing.Dict``[:py:class:``str, :py:class:str]

list(business_id, builders=None)

Get a list of resources.

Args: business_id: The business id builders: (Optional) List of builder objects for filters, pagination, etc.

Returns: ListResult: ListResult object with the resources response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.ListResult

update(business_id, resource_id, data)

Update a resource.

Args: business_id: The business id resource_id: Id of the resource to update data: Dictionary of data to update the resource to

Returns: Result: Result object with the updated resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

Time-Tracking

class freshbooks.api.timetracking.TimetrackingResource(client_config, list_resource_path, single_resource_path, list_name=None, single_name=None, missing_endpoints=None)

Bases: freshbooks.api.projects.ProjectsResource

Handles resources under the /timetracking endpoints.

These are handled identically to /projects endpoints. Refer to freshbooks.api.projects.ProjectsResource.

create(business_id, data)

Create a resource.

Args: business_id: The business id data: Dictionary of data to populate the resource

Returns: Result: Result object with the new resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

delete(business_id, resource_id)

Delete a resource.

Note: Most FreshBooks resources are soft-deleted, See FreshBooks API - Active and Deleted Objects

Args: business_id: The business id resource_id: Id of the resource to delete

Returns: Result: An empty Result object.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

get(business_id, resource_id)

Get a single resource with the corresponding id.

Args: business_id: The business id resource_id: Id of the resource to return Returns: Result: Result object with the resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

headers(method)

Get headers required for API calls

Return type

:py:class:~typing.Dict``[:py:class:``str, :py:class:str]

list(business_id, builders=None)

Get a list of resources.

Args: business_id: The business id builders: (Optional) List of builder objects for filters, pagination, etc.

Returns: ListResult: ListResult object with the resources response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.ListResult

update(business_id, resource_id, data)

Update a resource.

Args: business_id: The business id resource_id: Id of the resource to update data: Dictionary of data to update the resource to

Returns: Result: Result object with the updated resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

Payments

class freshbooks.api.payments.PaymentsResource(client_config, path, single_name, sub_path=None, defaults_path=None, static_params=None, missing_endpoints=None)

Handles resources under the /payments endpoints.

create(account_id, resource_id, data)

Create a resource.

Args: account_id: The alpha-numeric account id resource_id: Id of the resource to create payment details for data: Dictionary of data to populate the resource

Returns: Result: Result object with the new resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

defaults(account_id)

Get the default settings for an account resource.

Args: account_id: The alpha-numeric account id Returns: Result: Result object with the default data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

get(account_id, resource_id)

Get a single resource with the corresponding id.

Args: account_id: The alpha-numeric account id resource_id: Id of the resource to return payment details for Returns: Result: Result object with the resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

headers(method)

Get headers required for API calls

Return type

:py:class:~typing.Dict``[:py:class:``str, :py:class:str]

Events

class freshbooks.api.events.EventsResource(client_config, accounting_path, single_name, list_name, delete_via_update=True, missing_endpoints=None)

Bases: freshbooks.api.accounting.AccountingResource

Handles resources under the /events endpoints.

These are handled almost similarly to /accounting endpoints. Refer to freshbooks.api.accounting.AccountingResource.

create(account_id, data, includes=None)

Create a resource.

Args: account_id: The alpha-numeric account id data: Dictionary of data to populate the resource builders: (Optional) IncludesBuilder object for including additional data, sub-resources, etc.

Returns: Result: Result object with the new resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

delete(account_id, resource_id)

Delete a resource.

Note: Most FreshBooks resources are soft-deleted, See FreshBooks API - Active and Deleted Objects

Args: account_id: The alpha-numeric account id resource_id: Id of the resource to delete

Returns: Result: An empty Result object.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

get(account_id, resource_id, includes=None)

Get a single resource with the corresponding id.

Args: account_id: The alpha-numeric account id resource_id: Id of the resource to return builders: (Optional) IncludesBuilder object for including additional data, sub-resources, etc. Returns: Result: Result object with the resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

headers(method)

Get headers required for API calls

Return type

:py:class:~typing.Dict``[:py:class:``str, :py:class:str]

list(account_id, builders=None)

Get a list of resources.

Args: account_id: The alpha-numeric account id builders: (Optional) List of builder objects for filters, pagination, etc.

Returns: ListResult: ListResult object with the resources response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.ListResult

resend_verification(account_id, resource_id)

Tell FreshBooks to resend the verification webhook for the callback

Args: account_id: The alpha-numeric account id resource_id: Id of the resource to update

Returns: Result: Result object with the resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

update(account_id, resource_id, data, includes=None)

Update a resource.

Args: account_id: The alpha-numeric account id resource_id: Id of the resource to update data: Dictionary of data to update the resource to builders: (Optional) IncludesBuilder object for including additional data, sub-resources, etc.

Returns: Result: Result object with the updated resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result

verify(account_id, resource_id, verifier)

Verify webhook callback by making a put request

Args: account_id: The alpha-numeric account id resource_id: Id of the resource to update verifier: The string verifier received by the webhook callback URI

Returns: Result: Result object with the resource’s response data.

Raises: FreshBooksError: If the call is not successful.

Return type

:py:class:~freshbooks.models.Result