The AVACloud web service offers you an easy way to integrate all GAEB & tendering (AVA in German) workflows in your Node based application. This example shows you how to obtain an authentication token from Dangl.Identity, which will then be used with AVACloud to transform a GAEB file to Excel and finally do some analysis and reporting of the projects content.
Other use cases, such as converting from GAEB to GAEB or to the unified Dangl.AVA project system follow the same principles and are just as easy with the AVACloud Node client.
Node - GAEB Example Source Code
The source code for the example app is available on GitHub. You can download it and work directly with it. All you need is a recent NodeJs runtime.
Project Creation & AVACloud Client
If you want to create a new Node project, you can add the npm client @dangl/avacloud-client-node package.
Simply define the following function as your apps main entry point:
The variable accessToken is defined globally and is used in this example to provide the authentication token.
The authentication of AVACloud is based on OpenID and utilizes JSON Web Tokens (JWT) to authenticate and authorize API calls. If you have not done so yet, please register a Developer account at Dangl.Identity to get 30 days full access to AVACloud. If you need a longer evaluation phase, please contact DanglIT.
In the next step, we'll build a TypeScript function that authenticates itself via the Client Credentials grant type with Dangl.Identity to get access to the AVACloud API:
The variables clientId and clientSecret are defined globally and have to be set up by you. To implement authentication, you can use any OpenID Connect (OIDC) compatible library.
The actual authentication process is straightforward - you send your ClientId and your ClientSecret to the token endpoint of Dangl.Identity https://identity.dangl-it.com/connect/token and receive an access_token that is valid for 60 minutes for all API calls.
GAEB to Excel Conversion
The first task of the example app is to convert a GAEB file with AVACloud to a Microsoft Excel Workbook. This is the same way that you would convert between different GAEB formats or GAEB and the unified Dangl.AVA project system.
To read a local GAEB file, use the following snippet:
Access the GAEB Project Contents in Node
Customers of DanglIT get their main benefit not only by being able to convert GAEB files, but by transforming any GAEB files to the unified Dangl.AVA project model. With this format, you are able to integrate a single interface in your existing applications to be able to support all GAEB formats in Node.
It does not matter what kind of the many different GAEB files you have - AVACloud recognizes the correct type automatically and returns a unified data structure. The methods getProjectTotalPrice() and getProjectPositionCount() give you a small peek into how you can query the project model:
Create new Gaeb Files
With just a few more lines of code, you can also create new GAEB files in Node and TypeScript with the AVACloud API. Let's take a look at the following snippet:
First, we create a local variable avaProject - this unified project model can be used for exports to all GAEB versions and formats. In this element, we add a single position. It has the short text Concrete Wall, a unit tag m² as well as a quantity of 10 and a unit price of 80. Please contact us to get access to the documentation, where you'll find everything about the inified project model.
In the second step, we send the request to AVACloud and receive a GAEB file as a response. The file can then be saved locally.
Do you have questions regarding the usage of AVACloud? You want to quickly implement a GAEB interface for your Node application? Please contact us!