The AVACloud web service offers you an easy way to integrate all GAEB & tendering (AVA in German) workflows in your JavaScript 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 JavaScript client.

JavaScript - GAEB Example Source Code

The source code for the example app is available on GitHub. You can download it and work directly with it.

You can even test this demo right now online: Link to the live demo.

Project Creation & AVACloud Client

When you create a new project, you can directly reference the npm package @dangl/avacloud-client-javascript. You find the client code in the root folder of the module as bundle.js.

The postinstall script in this project copies the client bundle to dist/avacloud.bundle.js, which you can then reference from your web application. For productive environments, we suggest you use the bundle.min.js file to keep download times as low as possible.

App Entry

The entry point for the demo is a simple Html page, index.html. You can start the local server with the npm run serve command, the demo is then available at http://localhost:8080.

Client Authentication

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 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 and receive an access_token that is valid for 60 minutes for all API calls.

Careful: AVACloud uses JWT authentication tokens to authorize requests. Never give the token from the demo to anyone else. When you are planning to use AVACloud directly in the browser, you should proxy requests via your own server to prevent the leaking of your access credentials. Please contact us, we're happy to assist you in anything about security in web services.

Access the GAEB Project Contents in JavaScript

With the Dangl.AVA format, you are able to integrate a single interface in your existing applications to be able to support all GAEB formats in JavaScript.

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 method listAllPositions() give you a small peek into how you can query the project model by extracting all positions in the file and displaying them in a list:

Create new GAEB Files

With just a few more lines of code, you can also create new GAEB files in JavaScript 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 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 unified project model.

In the second step, we set the destinationGaebType: 'GaebXml_V3_2' parameter and send the request to AVACloud. The result will be a full GAEB file!

Do you have questions regarding the usage of AVACloud? You want to quickly implement a GAEB interface for your JavaScript application? Please contact us!