In this article
Disclaimer: This functionality is in development, the specifications may be changed at any time, with or without notice. This functionality can be removed in future products or subject to additional costs.
Starting the web server
The web server enable you to access the accounting data through http.
The web server is started from the dialog Program Options unter the menu Tools.
Once the web server is started you can access to the server by typing the address "localhost:8081" in your browser or application.
Settings
The settings of the file server, like the listening port number and others, are stored in the following file:
Windows: "C:/Users/{user_name}/AppData/Local/Banana.ch/Banana/7.0/httpconfig.ini"
Mac: "/Users/{user_name}/Library/Application Support/Banana.ch/Banana/7.0/httpconfig.ini"
Linux: "/home/{user_name}/.local/share/data/Banana.ch/Banana/7.0/httpconfig.ini"
Resources API v1.0
/
Show the home page of the web server and enable you to navigate the content of the accounting files.
/docs
Return the list of opened documents as json array.
Examples:
/docs Returns: ["accounting.ac2","accounting previous year.ac2", ...]
/doc/{doc_name}/tablenames
Return the list of tables in document doc_name as json array.
Examples:
/doc/accounting.ac2/tables Returns: ["Accounting","Transactions", ...]
/doc/{doc_name}/table/{table_name}
Return the content of table table_name in document doc_name as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
Examples:
/doc/accounting.ac2/table/Accounts /doc/accounting.ac2/table/Accounts?view=Base /doc/accounting.ac2/table/Accounts?columns=Account,Group,Description,Balance
/doc/{doc_name}/table/{table_name}/rowcount
Return the number of rows in the table table_name as text.
/doc/{doc_name}/table/{table_name}/columnnames
Return the list of columns as json array.
/doc/{doc_name}/table/{table_name}/row/{row_nr}/column/{col_name}
Return the value of cell at row row_nr and column col_name as text.
The part row_nr can be a row number starting from 1 or an expression like 'Account=1000' (In this ex. the first row where the field Account is equal to 1000 is used)
The part col_name is the xml name of the requested column.
Examples:
/doc/accounting.ac2/table/Accounts/row/2/Description /doc/accounting.ac2/table/Accounts/row/Account=1000/Balance
/doc/{doc_name}/accounts
Return the list of accounts as json array.
Examples:
/doc/accounting.ac2/accounts Returns: [{"id":"1000","descr":"1000 Cash"}, {"id":"1010","descr":"1000 Post"}, ...]
/doc/{doc_name}/groups
Return the list of groups as json array.
Examples:
/doc/accounting.ac2/groups Returns: [{"id":"100","descr":"100 Current Assets"}, ...]
/doc/{doc_name}/vatcodes
Return the list of vatcodes as json array.
Examples:
/doc/accounting.ac2/vatcodes Returns: [{"id":"V80","descr":"V80 Sales and services 8.0%"}, ...]
/doc/{doc_name}/accountcard/{account_id}
Return the account card of account account_id as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
period Define the start and end date for the request.
It can contain a period abbreviation like '1Q' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/doc/accounting.ac2/accountcard/1000 /doc/accounting.ac2/accountcard/1000?period=Q1 /doc/accounting.ac2/accountcard/1000?period=2014-01-01/2014-03-31 /doc/accounting.ac2/accountcard/1000?filter=row.value("Description").contain("xyz")
/doc/{doc_name}/balance/{account_id|Gr=group_id|BClass=class_id}/{opening|credit|debit|total|balance|openingcurrency|...}
Return the current balance of the requested account, group or bclass as text.
The last part or the url can be one of the followings strings:
- opening
- credit
- debit
- total
- balance
- openingcurrency
- ceditcurrency
- debitcurrency
- totalcurrency
- balancecurrency
- rowcount
Parameters:
period Define the start and end date for the request.
It can contain a period abbreviation like '1Q' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/doc/accounting.ac2/balance/1000/opening /doc/accounting.ac2/balance/1000|1010|1020|1030/opening /doc/accounting.ac2/balance/Gr=6/totalcurrency?period=Q1 /doc/accounting.ac2/balance/BClass=1/balance
/doc/{doc_name}/budgetcard/{account_id}
Return the budget card of account account_id as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
period Define the start and end date for the request.
It can contain a period abbreviation like '1Q' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Introduced in 7.0.7.0
Examples:
/doc/accounting.ac2/budgetcard/1000 /doc/accounting.ac2/budgetcard/1000?period=Q1 /doc/accounting.ac2/budgetcard/1000?period=2014-01-01/2014-03-31
/doc/{doc_name}/budget/{account_id|Gr=group_id|BClass=class_id}/{opening|credit|debit|total|balance|openingcurrency|...}
Return the budget of the requested account, group or bclass as text.
The last part or the url can be one of the followings strings:
- opening
- credit
- debit
- total
- balance
- openingcurrency
- ceditcurrency
- debitcurrency
- totalcurrency
- balancecurrency
- rowcount
Parameters:
period Define the start and end date for the request.
It can contain a period abbreviation like '1Q' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/doc/accounting.ac2/budget/1000/opening /doc/accounting.ac2/budget/1000|1010|1020|1030/opening /doc/accounting.ac2/budget/Gr=6/totalcurrency?period=Q1 /doc/accounting.ac2/budget/BClass=1/balance
/doc/{doc_name}/projection/{account_id|Gr=group_id|BClass=class_id}/{opening|credit|debit|total|balance|openingcurrency|...}
Return the projection of the requested account, group or bclass as text.
The last part or the url can be one of the followings strings:
- opening
- credit
- debit
- total
- balance
- openingcurrency
- ceditcurrency
- debitcurrency
- totalcurrency
- balancecurrency
- rowcount
Parameters:
projectionstart This parameter is mandatory and define the start date of the projection.
It can contain a period abbreviation like 'Q1' (start at beginnig of) or a date like '2014-07-01'.
period Define the start and end date for the request.
It can contain a period abbreviation like '1Q' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/doc/accounting.ac2/projection/1000/opening?projectionstart=S1 /doc/accounting.ac2/projection/1000/opening?projectionstart=2014-07-01
/doc/{doc_name}/vatbalance/{vat_code|Gr=vat_group}/{taxable|amount|notdeductible|posted}
Return the current balance of the requested vat code as text.
The last part of the url can be one of the followings strings:
- taxable
- amount
- notdeductible
- posted
- rowcount
Parameters:
period Define the start and end date for the request.
It can contain a period abbreviation like '1Q' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/doc/accounting.ac2/vatbalance/V80/balance
/doc/{doc_name}/vatbudget/{vat_code|Gr=vat_group}/{taxable|amount|notdeductible|posted}
Return the budget of the requested vat code as text.
The last part or the url can be one of the followings strings:
- taxable
- amount
- notdeductible
- posted
- rowcount
Parameters:
period Define the start and end date for the request.
It can contain a period abbreviation like '1Q' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/doc/accounting.ac2/vatbudget/V80/balance
/doc/{doc_name}/accreport
Return the accounting report for the document doc_name as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
period Define the start and end date for the request.
It can contain a period abbreviation like '1Q' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
subdivision Define the period subdivision for the request .A period subdivision is defined by one of the following charachters:
- M for monthly subdivision
- Q for quarter sudbivision
- S for semester subdivision
- Y for year subdivision
Examples:
/doc/accounting.ac2/accreport /doc/accounting.ac2/accreport?period=Q1 /doc/accounting.ac2/accreport?subdivision=Q
/doc/{doc_name}/vatreport
Return the vat report for the document doc_name as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
period Define the start and end date for the request.
It can contain a period abbreviation like '1Q' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
Examples:
/doc/accounting.ac2/vatreport /doc/accounting.ac2/vatreport?period=Q3
/doc/{doc_name}/journal
Return the journal for the document doc_name as html.
Parameters:
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
doc/{doc_name}/startperiod
Return the start date in the form of 'YYYY-MM-DD'.
Parameters:
period Define the period for the request.
It can contain a period abbreviation like '1Q' or be empry. If period is not present or empty the accounting start date is returned.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
See also endPeriod.
Introduced in 7.0.7.0
Examples:
/doc/accounting.ac2/startperiod /doc/accounting.ac2/startPeriod?period=Q3
doc/{doc_name}/endPeriod
Return the end date in the form of 'YYYY-MM-DD'.
Parameters:
period Define the period for the request.
It can contain a period abbreviation like '1Q' or be empry. If period is not present or empty the accounting end date is returned.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
See also startPeriod.
Introduced in 7.0.7.0
Examples:
/doc/accounting.ac2/endPeriod /doc/accounting.ac2/endperiod?period=Q3
/doc/{doc_name}/info
Return the info table as html.
Parameters:
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
/doc/{doc_name}/info/{info_section_name}/{info_id_name}
Return the info value section:id as text.
Examples:
/doc/accounting.ac2/info/AccountingDataBase/BasicCurrency
/doc/{doc_name}/infos
Return the infos of document doc_name as json object.
Examples:
/doc/accounting.ac2/infos Returns: [{"section":"Base", "id":"FileInfo", "value":""},{"section":"Base", "id":"Date", "value":"2014-05-13"}, ...]
/doc/{doc_name}/messages/count
Return the number of error messages in the accounting file.
Parameters:
recheck If set to 'yes' a 'Recheck accounting' is executed.
/script?scriptfile=path_to_script
Execute the script scriptfile.
Parameters:
scriptfile Define the path of the script to be executed.The path can be an absolute path or a path relative to the user's document directory.
ac2file Define the name of an opened document to be passed to the script. It is optional.
indata Contains text data to be passed to the script. It is optional.
Examples:
/script?scriptfile=getresults.js /script?scriptfile=getresults.js&ac2file=accounting.ac2
/settings
Show the settings of the web server.
/help
Show the help of the web server.
Data formats API
Date
Date values are in ISO 8601 format 'YYYY-MM-DD'.
Decimal
Decimal values have a '.' (dot) as decimal separator and doesn't have a group separator. For example: '12345.67'.Decimal values are rounded according to the accounting settings.
Text
Text values can contain any character supported by UTF-8.
Time
Time values are in ISO 8601 format 'HH:MM:SS'. The formats 'HH:MM' and 'HH:MM:SS.ZZZ are also accepted.