In this article
Banana Accounting has an integrated web server that allow to access the accounting data through a browser or another software through a RESTful API, that can be accessed through with an http protocol.
This feature is only available with the Advanced plan.
Excel, Word, Access and other software have the ability to integrate documents and data made available through the internet protocol.
The web server can't be used to write to the accounting file.
Starting the web server
The web server enables you to access the accounting data through http.
The web server is started from the Program Options dialog under the Tools menu.
Once the web server is started you can access to the server by typing the address "http://localhost:8081/" in your browser or in your application.
Settings
The settings of the file server, like the listening port number and others, are stored in the httpconfig.ini file.
The location of the file is the following:
- Windows: "C:/Users/{user_name}/AppData/Local/Banana.ch/BananaPlus/10.0/httpconfig.ini"
- Mac: "/Users/{user_name}/Library/Application Support/Banana.ch/BananaPlus/10.0/httpconfig.ini"
- Linux: "/home/{user_name}/.local/share/data/Banana.ch/BananaPlus/10.0/httpconfig.ini"
In case the file is not found as indicated above, you can follow the steps below to find and access it:
- Click on menu Tools > Program Options.
- Select the tab Advanced.
- Click on System info button under Develop section.
- Select the entry Web Server > Settings file path.
- Click on Open path button to open the directory where the httpconfig.ini file is located.
- Open the file httpconfig.ini with any text editor to edit the file.
To apply the changes made in the httpconfig.ini file it's required to save the file, close and reopen Banana Accounting Plus.
Certificates
The web server uses Banana certificates.
If you want to use your own certificates, you need to save the certificates (.key and .pem files) in the Ssl directory of Banana application (saving certificate files in a different directory doesn't work because Banana always checks for the files inside the Ssl directory). Then you need to change the names of sslCertFile and sslKeyFile parameters in the httpconfig.ini file.
Windows example:
[Https]
sslKeyFile=C:/Users/username/AppData/Local/Programs/BananaPlus/Ssl/banana.localhost.key
sslCertFile=C:/Users/username/AppData/Local/Programs/BananaPlus/Ssl/banana.localhost.pem
macOS example:
[Https]
sslCertFile=/Applications/BananaPlus.app/Contents/Resources/Ssl/banana.localhost.pem
sslKeyFile=/Applications/BananaPlus.app/Contents/Resources/Ssl/banana.localhost.key
Security
To limit access to the web server, it is possible to set an access token in the settings parameter Banana/accessToken.
[Banana] accessControlAllowOrigin=https://www.banana.ch accessToken=b8nmr1a
In this case the caller have to send the request with the same accessToken set in the http header "X-Banana-Access-Token" or in the query parameter "acstkn". If the token doesn't match the server will answer with a 401 unauthorised.
http://localhost:8081/v2?acstkn=b8nmr1a
The settings parameter Banana/accessControlAllowOrigin=https://www.banana.ch is needed to allow the Banana Excel Addin to access the web server. You can set it to '*' if you want to allow the access from other Addins too.
Since Banana 9.1.0
API
The latest version of Banana Accounting Plus (version 10.1.7 or more recent) support both versions V1 and V2.
Previous versions of Banana Accounting support only the V1 version. The version V1 is no longer developed.
- API Version V2
This is the currently developed version. It is supported by Banana Accounting Plus (version 10.1.7 or more recent).
This version is fully compatible with V1 version (what worked with V1 also works with V2). - API Version V1 (outdated)
This is the legacy version, supported by Banana9 and BananaPlus. It is no longer developed.
Data formats
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.