Static application

Lesson 16 out of 29

Some tasks may call for an application with a completely front-end-based logic. Such an application lacks the capability to receive REST events or register widgets, but does not necessitate its own server. Bitrix24 refers to these applications as "static," as they are comprised of HTML and JS files and REST API calls are executed through JavaScript.

Static application

3 min

To create a new application, we enter the Developer area and repeat the process we followed in the previous lesson.

We click the "New Application" button, select the main region, and select "use REST API" as the application type. But instead of providing links to files on a server, we attach an archive containing the application, which can be obtained from the lesson materials.

After saving and closing the slider, we edit the application name to "Static App Example" and save the changes.

Testing the application involves entering our Bitrix24 address where we have administrator privileges and clicking Install. Bitrix24 automatically opens the application after successful installation, as it has a user interface.

Examining the inner workings of the application, we start with the install.html file.

Important

Like in the case of server applications, the application must inform Bitrix24 of a successful installation through the installFinish js-method of a special js-library. Upon the application's execution of this function, Bitrix24 recognizes the installation as successful and redirects the user to the index.html file within the archive. This file is mandatory, but other html pages, CSS files, and JS libraries may also be included.

The REST API is utilized through methods from the special js-library.

Our example, for instance, calls the user.current method, which retrieves information about the current user.

Important

It is important to note that, like any other JavaScript HTTP requests, REST API method calls are asynchronous, and their results are processed in a handler function.

The application framework is now in place, allowing for customization through the addition of necessary functionality.

The updated archive can be reinstalled on our portal, and, after thorough debugging, the solution can be published on Bitrix24.Market.

Resources

Lesson materials: