Tutorials

Representing Onesait Platform data through Power BI

At some point, you may have wanted to use data from the Onesait Platftorm and exploit them with some specialized BI tool, even if our Platform’s Dashboards offer a wide range of options for this. But there may be times when you need to use another type of tool, such as Power BI.

In this entry, we will see the steps that must be followed from exposing the data stored in the Platform Ontologies, to how to use them in Power BI.

The first step will be to have an Ontology populated with the data you want to exploit. For this entry, use the «Restaurants» Ontology, which contains information about several restaurants and has 150 records, as shown in the following image:

One way to ingest data in Power BI is through the use of APIs, so you will next expose your data through an API.

To create an API within the Platform, you must select the option Development > My APIs.

Once in the APIs list, select the option «Create», in the upper right part.

Next, you must fill in the API creation form, assign an identifier, a category, select «Ontology as REST API» as the API type (since you want to expose a Platform Ontology), and select the Ontology you want to expose, in this case «Restaurants».

Finally, the API itself must be configured. On the one hand, you are going to create a «Get» that returns all the information of the Ontology, and on the other hand, you will use the possibility of creating customized queries to bring a grouping of the number of restaurants per neighbourhood. To expose all the information, simply select the «Query(All)» operation and assign a description.

To create a «Get» operation to display a custom query, you must select the «Query Custom» operation and fill in the corresponding form, giving a name and a description, and including the query you want to execute.

Once the API is created, you can move on to Power BI. To ingest data from an API Rest from Power BI, you must select the «Web» option within the Get Data dropdown menu.

Since the Onesait Platform APIs are secured, you need to include a user token. To make this configuration in Power BI, select the option «Advanced Use».

For the case in this entry, both an endpoint and a user token are required. The endpoint can be queried in the recently-created API by selecting the option «View» in the API list, then checking at the section «Endpoint Base».

As for the user token, it can be found in the «User Tokens» option in the API list at the top right.

With this information, you can already configure Power BI. In the different parts of the URL, first add the «Endpoint Base», then the name of the customized operation (in this case you will use this API). Then, under the header parameters, include the user token with the key «X-OP-APIKey», and since the data will be returned in JSON format, include an «accept» with the value application/json.

After entering this configuration, the data returned by the customized query you had created will be available in Power BI.

Once it is correctly configured, select the option «Close and Apply».

With this data, you can make a simple ring representation. To do this, select the option «Ring Graph».

Select the fields you want to represent:

And with this you already have a basic representation.

If you wanted to use all the information of the Ontology, you could enter the API that you created for this purpose. The configuration of the call would be exactly the same as in the previous case, except that in the URL you would have to include nothing but the «Endpoint Base».

And, after configuring the response to your liking, the data would be available in Power BI.

With these steps, the data that you have made available from the Onesait Platform would already be accessible in Power BI, and can be exploited by and from that tool.

In short, to access data from the Onesait Platform, an API must be created to display the data you want to exploit. Once the API is created, it will be invoked from Power BI from the Endpoint Base and the user token, leaving the data you have exposed available in this tool.

Easy, isn’t it? Then, it’s time for you to exploit that data.

✍🏻 Author(s)

One thought on “Representing Onesait Platform data through Power BI

Leave a Reply

Your email address will not be published. Required fields are marked *