You can create your own API Endpoints using BellaDati Extensions feature. This tutorial describes how to create an endpoint which exports public Report to XLS.
- You have BellaDati instance in version 126.96.36.199+.
- You have role Super Admin in multi-domain environment or Domain Admin in single-domain environment.
- You are familiar with Java/Groovy.
- You have a public Report. Refer to Public Report section in Sharing Report documentation.
Step 1. Create an Extension
- Go to Manage extensions page that is available in the Extensions section, under Administration menu.
- Click on Create extension
- Create an Extension with type Create new page
Step 2. Create an API Endpoint in Extension
After creating the Extension you should be redirected to Extension detail.
- In the panel on the left click on API Endpoints
- Click on Add button
- Name the endpoint and click on Add
Step 3. Write code which will export Report to XLS and send it to client
After creating the Endpoint you should be redirected to Endpoint detail with code editor where you can write/paste your code.
In the Endpoint class are 2 methods, doGet() and doPost(). Each will be executed based on the endpoint call method (GET/POST).
We will call this endpoint as GET so we will write the code in the doGet() method. Refer to the code below:
Step 4. Endpoint usage
Extension has to be activated before the endpoint can be used. We also have to activate Public access so public users will be able to use the endpoint.
Endpoint is now ready to use so we can try it.
Clicking on Link above the code editor will open URL with our endpoint. We just have to append parameter "reportId" with ID of Report which should be exported (refer to implementation above).
Your URL should look like this:
Example usage in HTML: