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
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.
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.
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 https://identity.dangl-it.com/connect/token 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.
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
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 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!