Getting started with VBOnline API
Welcome to VBOnline REST API documentation. This page is created so you can maximise the usage of VBOnline API.
Installation
Preconditions
Before installing there are a few things you will need:
a license key, which you can get at “support@vbonline.no”
a VBS server license from Visma and proxy/web-server
a confirmation from your operation supplier that the firewall has been cleared between the customers app-server and reversed proxy
Installation
A detalied description of the installation steps can be found here
Upgrade the API
In order to upgrade the API to the current version, please follow the instructions here.
Aquire the the code at Google Drive
Choose the folder with the highest number which begins with VBONLINEAPI - standardsolution - otherwise are customizedChoose the correct edition in accordance to your Visma version
Download the correct version to the servers download folder
Unzip the file
Copy the sub-folder to the same catalog as the other VBINTERFACE catalogs
Rename the folder in accorance to the previous installed versions
Copy SetParameters.xml from previous active folder to the new folder and approve the overwrite
Start cmd/command prompt in administrator mode
Locate the new folder
Run the command vbinterface.deploy /Y
You have completed the installation and may close all opened windows
Checklist
Start VBOnline WEB, https://vbonline.no/XXXX/#/login, where XXXX is the abbreviation of your company, and make sure that the API version and Visma Business version is correct at the login screen.
Services
The API offers 300 services through “Swagger”. Swagger is a tool that can help you with design and documentation of the API.
In order to access Swagger, go to https://vbi.okonomibistand.no/VBInterfaceXXXX/swagger/ui/index,
where XXXX is the identifier for your company.
Example: https://vbi.okonomibistand.no/VBInterfaceOBIDev/swagger/ui/index
Using Swagger you can find all operations for each method used in the API, with a description of how to use it, as well as example code.
Following are some of the most used services and how you can use them.
Logging in to the API
Logging in to the API is done through a simple login screen using this HTML script. Here you will see that you need an endpoint, username and password. The endpoint is https://vbi.okonomibistand.no/VBInterfaceXXXX/swagger/ui/index#, where “XXXX“ is your company’s abbreviation.
After you have put in the endpoint, as well as your username and password, a token will be generated and you have logged in to the API and recieved the Authorization key needed for further service use.
PostBatch
Used when trying to make inputs/requests with the least amount of required fields. This example shows this sort of request. Note that you will need to change som data to fit your configurations, such as debit/credit account numbers, customer numbers and supplier numbers. The parameters used in PostBatch are “Batch” and “Authorization“, where Batch is a JSON file like the one referenced and the Authorization is the token key retrieved from the token service. After successful POST, you can view the imported data in VBOnline at Open Batches under Report Menu at the homepage.
PostOrder
Used when wanting to post an order through the API.The parameters needed are an “order” and an “authorization”. The order needs to be a JSON file looking something like this, and the authorization is the token you can get from the token service. The request URL looks like this https://vbi.okonomibistand.no/XXXX/api/Order, where “XXXX“ is your company’s abbreviation.
Expired token
When working with your UI you may test the return value for the token and test it on the value token.expires – here is an example-function detailing the process. The token is valid until you close the browser as its value resides in localstorage.
The json object token also includes the value token.expires, which holds the timestamp the token expires. In your UI you can then make a test on this value and do a new login if it expired
PostToken
PostToken is used to retrieve an access-token. The token will be of a “bearer-type”, and is used to authorize access to several functions within the API. In order to retrieve the token you can use third-party sites, such as PostMan, or you can write your own shell-script. The requirements for retrieving the token is valid login information containing a username, your password, as well as a grant_type set to “password”. The endpoint should look something like this: https://vbi.okonomibistand.no/XXXX/token, where “XXXX“ is your company’s abbreviation.
GetCustomer
GetCustomer can be used through the HTML file used for Log in to the API, your own script or PostMan. There are several GetCustomer variants to choose from, but the most covering version should look something like this. The parameters needed is the ClientId of the customer you would like as well as the Token key generated at login.