BexioApiClient. Accounting
(bexio_api_client v2.0.0)
Copy Markdown
Bexio API for the accounting part of the API.
Summary
Types
One multipart/form-data part for uploading files to manual entries,
following the :form_multipart format of Req.
Functions
Upload one or multiple files and attach them to a manual compound entry.
Upload one or multiple files and attach them to a manual entry line
(only for the entry types :manual_single_entry and :manual_group_entry).
Create a calendar year.
Create a currency. The name must be in the ISO 4217 format and must be unique.
Create a manual entry for the account ledger.
Delete a currency.
Delete the connection between a file and a manual compound entry.
Delete a manual entry.
Delete the connection between a file and a manual entry line
(only for the entry types :manual_single_entry and :manual_group_entry).
Delete a tax.
Update a currency (only the round factor can be changed).
Update a manual entry.
Fetch a list of account groups.
Fetch a list of accounts.
Fetch a single business year.
Fetch a list of business years.
Fetch a single calendar year.
Fetch a list of calendar years.
Fetch a list of currencies.
Fetch a single currency.
Fetch all possible currency codes (in the format CHF, EUR, etc.).
Fetch a list of currency exchange rates.
Fetch the accounting journal.
Fetch a file attached to a manual compound entry.
Fetch the files attached to a manual compound entry.
Fetch a list of manual entries.
Fetch a file attached to a manual entry line
(only for the entry types :manual_single_entry and :manual_group_entry).
Fetch the files attached to a manual entry line.
Fetch the next reference number for a manual entry.
Fetch a single tax.
Fetch a list of taxes.
Fetch a single vat period.
Fetch a list of vat periods.
Search accounts via query. The following search fields are supported
Search calendar years via query.
Types
@type api_error_type() :: BexioApiClient.Helpers.api_error_type()
One multipart/form-data part for uploading files to manual entries,
following the :form_multipart format of Req.
@type file_upload_parts() :: [file_upload_part()]
Functions
@spec add_manual_compound_entry_file( req :: Req.Request.t(), manual_entry_id :: non_neg_integer(), files :: file_upload_parts() ) :: {:ok, [BexioApiClient.Accounting.ManualEntryFile.t()]} | api_error_type()
Upload one or multiple files and attach them to a manual compound entry.
The files are passed to Req as :form_multipart, e.g.:
[fileName1: {"<file content>", filename: "screenshot.png"}]Max. file size is 12MB, supported formats are PNG, JPG, JPEG, GIF, DOC, DOCX, XLS, XLSX, PPT, PPTX and PDF.
@spec add_manual_entry_line_file( req :: Req.Request.t(), manual_entry_id :: non_neg_integer(), entry_id :: non_neg_integer(), files :: file_upload_parts() ) :: {:ok, [BexioApiClient.Accounting.ManualEntryFile.t()]} | api_error_type()
Upload one or multiple files and attach them to a manual entry line
(only for the entry types :manual_single_entry and :manual_group_entry).
The files are passed to Req as :form_multipart, e.g.:
[fileName1: {"<file content>", filename: "screenshot.png"}]Max. file size is 12MB, supported formats are PNG, JPG, JPEG, GIF, DOC, DOCX, XLS, XLSX, PPT, PPTX and PDF.
@spec create_calendar_year( req :: Req.Request.t(), year :: String.t() | non_neg_integer(), opts :: [ vat_subject?: boolean(), annual_reporting?: boolean(), vat_accounting_method: :effective | :net_tax, vat_accounting_type: :agreed | :collected, default_tax_income_id: integer(), default_tax_expense_id: integer() ] ) :: {:ok, [BexioApiClient.Accounting.CalendarYear.t()]} | api_error_type()
Create a calendar year.
If only the year is given, the next year is created with the same settings as the year before, otherwise all settings must be given.
The response is a list of calendar years because bexio creates all the years in between when creating a future year.
@spec create_currency( req :: Req.Request.t(), currency :: BexioApiClient.Accounting.Currency.t() ) :: {:ok, BexioApiClient.Accounting.Currency.t()} | api_error_type()
Create a currency. The name must be in the ISO 4217 format and must be unique.
@spec create_manual_entry( req :: Req.Request.t(), manual_entry :: BexioApiClient.Accounting.ManualEntry.t() ) :: {:ok, BexioApiClient.Accounting.ManualEntry.t()} | api_error_type()
Create a manual entry for the account ledger.
@spec delete_currency(req :: Req.Request.t(), currency_id :: non_neg_integer()) :: {:ok, boolean()} | api_error_type()
Delete a currency.
@spec delete_manual_compound_entry_file( req :: Req.Request.t(), manual_entry_id :: non_neg_integer(), file_id :: non_neg_integer() ) :: {:ok, boolean()} | api_error_type()
Delete the connection between a file and a manual compound entry.
@spec delete_manual_entry( req :: Req.Request.t(), manual_entry_id :: non_neg_integer() ) :: {:ok, boolean()} | api_error_type()
Delete a manual entry.
@spec delete_manual_entry_line_file( req :: Req.Request.t(), manual_entry_id :: non_neg_integer(), entry_id :: non_neg_integer(), file_id :: non_neg_integer() ) :: {:ok, boolean()} | api_error_type()
Delete the connection between a file and a manual entry line
(only for the entry types :manual_single_entry and :manual_group_entry).
@spec delete_tax(req :: Req.Request.t(), tax_id :: non_neg_integer()) :: {:ok, boolean()} | api_error_type()
Delete a tax.
Taxes which are used and/or referenced within bexio, and taxes assigned to the digit 000 can not be deleted — the API answers with a conflict error.
@spec edit_currency( req :: Req.Request.t(), currency :: BexioApiClient.Accounting.Currency.t() ) :: {:ok, BexioApiClient.Accounting.Currency.t()} | api_error_type()
Update a currency (only the round factor can be changed).
@spec edit_manual_entry( req :: Req.Request.t(), manual_entry :: BexioApiClient.Accounting.ManualEntry.t() ) :: {:ok, BexioApiClient.Accounting.ManualEntry.t()} | api_error_type()
Update a manual entry.
@spec fetch_account_groups( req :: Req.Request.t(), opts :: [BexioApiClient.GlobalArguments.offset_without_order_by_arg()] ) :: {:ok, [BexioApiClient.Accounting.AccountGroup.t()]} | api_error_type()
Fetch a list of account groups.
@spec fetch_accounts( req :: Req.Request.t(), opts :: [BexioApiClient.GlobalArguments.offset_without_order_by_arg()] ) :: {:ok, [BexioApiClient.Accounting.Account.t()]} | api_error_type()
Fetch a list of accounts.
@spec fetch_business_year( req :: Req.Request.t(), business_year_id :: non_neg_integer() ) :: {:ok, BexioApiClient.Accounting.BusinessYear.t()} | api_error_type()
Fetch a single business year.
@spec fetch_business_years( req :: Req.Request.t(), opts :: [BexioApiClient.GlobalArguments.offset_without_order_by_arg()] ) :: {:ok, [BexioApiClient.Accounting.BusinessYear.t()]} | api_error_type()
Fetch a list of business years.
@spec fetch_calendar_year( req :: Req.Request.t(), calendar_year_id :: non_neg_integer() ) :: {:ok, BexioApiClient.Accounting.CalendarYear.t()} | api_error_type()
Fetch a single calendar year.
@spec fetch_calendar_years( req :: Req.Request.t(), opts :: [BexioApiClient.GlobalArguments.offset_without_order_by_arg()] ) :: {:ok, [BexioApiClient.Accounting.CalendarYear.t()]} | api_error_type()
Fetch a list of calendar years.
@spec fetch_currencies( req :: Req.Request.t(), opts :: [BexioApiClient.GlobalArguments.offset_without_order_by_arg()] ) :: {:ok, [BexioApiClient.Accounting.Currency.t()]} | api_error_type()
Fetch a list of currencies.
@spec fetch_currency(req :: Req.Request.t(), currency_id :: non_neg_integer()) :: {:ok, BexioApiClient.Accounting.Currency.t()} | api_error_type()
Fetch a single currency.
@spec fetch_currency_codes(req :: Req.Request.t()) :: {:ok, [String.t()]} | api_error_type()
Fetch all possible currency codes (in the format CHF, EUR, etc.).
@spec fetch_exchange_rates( req :: Req.Request.t(), id :: integer(), opts :: [BexioApiClient.GlobalArguments.offset_without_order_by_arg()] ) :: {:ok, [BexioApiClient.Accounting.ExchangeRate.t()]} | api_error_type()
Fetch a list of currency exchange rates.
@spec fetch_journal( req :: Req.Request.t(), opts :: [ BexioApiClient.GlobalArguments.offset_without_order_by_arg() | {:from, Date.t()} | {:to, Date.t()} | {:account_uuid, String.t()} ] ) :: {:ok, [BexioApiClient.Accounting.JournalEntry.t()]} | api_error_type()
Fetch the accounting journal.
Arguments (in opts):
:from- filter for entries after this date:to- filter for entries until this date:account_uuid- filter for entries with an account with this uuid
@spec fetch_manual_compound_entry_file( req :: Req.Request.t(), manual_entry_id :: non_neg_integer(), file_id :: non_neg_integer() ) :: {:ok, BexioApiClient.Accounting.ManualEntryFile.t()} | api_error_type()
Fetch a file attached to a manual compound entry.
@spec fetch_manual_compound_entry_files( req :: Req.Request.t(), manual_entry_id :: non_neg_integer(), opts :: [BexioApiClient.GlobalArguments.offset_without_order_by_arg()] ) :: {:ok, [BexioApiClient.Accounting.ManualEntryFile.t()]} | api_error_type()
Fetch the files attached to a manual compound entry.
@spec fetch_manual_entries( req :: Req.Request.t(), opts :: [BexioApiClient.GlobalArguments.offset_without_order_by_arg()] ) :: {:ok, [BexioApiClient.Accounting.ManualEntry.t()]} | api_error_type()
Fetch a list of manual entries.
@spec fetch_manual_entry_line_file( req :: Req.Request.t(), manual_entry_id :: non_neg_integer(), entry_id :: non_neg_integer(), file_id :: non_neg_integer() ) :: {:ok, BexioApiClient.Accounting.ManualEntryFile.t()} | api_error_type()
Fetch a file attached to a manual entry line
(only for the entry types :manual_single_entry and :manual_group_entry).
@spec fetch_manual_entry_line_files( req :: Req.Request.t(), manual_entry_id :: non_neg_integer(), entry_id :: non_neg_integer(), opts :: [BexioApiClient.GlobalArguments.offset_without_order_by_arg()] ) :: {:ok, [BexioApiClient.Accounting.ManualEntryFile.t()]} | api_error_type()
Fetch the files attached to a manual entry line.
@spec fetch_next_manual_entry_reference_nr(req :: Req.Request.t()) :: {:ok, String.t()} | api_error_type()
Fetch the next reference number for a manual entry.
@spec fetch_tax(req :: Req.Request.t(), tax_id :: non_neg_integer()) :: {:ok, BexioApiClient.Accounting.Tax.t()} | api_error_type()
Fetch a single tax.
@spec fetch_taxes( req :: Req.Request.t(), date :: Date.t() | nil, types :: :sales_tax | :pre_tax | nil, opts :: [BexioApiClient.GlobalArguments.offset_without_order_by_arg()] ) :: {:ok, [BexioApiClient.Accounting.Tax.t()]} | api_error_type()
Fetch a list of taxes.
Arguments:
date- all taxes which are active at the date giventypes- filter the types of tax (:sales_tax or :pre_tax)
@spec fetch_vat_period(req :: Req.Request.t(), vat_period_id :: non_neg_integer()) :: {:ok, BexioApiClient.Accounting.VatPeriod.t()} | api_error_type()
Fetch a single vat period.
@spec fetch_vat_periods( req :: Req.Request.t(), opts :: [BexioApiClient.GlobalArguments.offset_without_order_by_arg()] ) :: {:ok, [BexioApiClient.Accounting.VatPeriod.t()]} | api_error_type()
Fetch a list of vat periods.
@spec search_accounts( req :: Req.Request.t(), criteria :: [BexioApiClient.SearchCriteria.t()], opts :: [BexioApiClient.GlobalArguments.offset_without_order_by_arg()] ) :: {:ok, [BexioApiClient.Accounting.Account.t()]} | api_error_type()
Search accounts via query. The following search fields are supported:
- account_no
- fibo_account_group_id (TODO: test this)
- name
- account_type
@spec search_calendar_years( req :: Req.Request.t(), criteria :: [BexioApiClient.SearchCriteria.t()], opts :: [BexioApiClient.GlobalArguments.offset_without_order_by_arg()] ) :: {:ok, [BexioApiClient.Accounting.CalendarYear.t()]} | api_error_type()
Search calendar years via query.
If you want to search for the end date, use the :like criteria instead of
:equal, because searching for equality requires the date in the format
"2018-12-31 23:59:59".