Connect any 3D Repo data to Power BI

Learn how to create a live link between 3D Repo & Power BI using Web Query

F
Written by Faisal Ramady
Updated over a week ago

It's amazing how much data can be linked to Power BI using APIs. Before we begin our quick and easy journey if you are not familiar with the concept of APIs or 3D Repo's APIs in particular, have a read through the following articles:

Web API query

Power BI is an excellent tool to aggregate multiple data tables together and present all of that data in a custom dashboard layout. On top of that, using web queries will show you how easy & effective 3D Repo APIs. Using Web Queries we can make an API GET Request to 3D Repo and receive a successful response in form of a JSON body. Let's go through it step by step and see how easy it is to set up. Feel free to download a blank Power BI Template or start completely from scratch.

Sample API Request

In this example, we will perform the following GET Request that will retrieve all the BIM data stored in a model in 3D Repo. Of course, you can make any other API request if you wish. Here is what the Get all metadata API call looks like in our API Docs:

We'll be required to provide the following Variable information:

  • teamspace name of the Teamspace a model belongs to

  • model is the unique Model ID (retrieve it from the model settings menu)

  • APIKey will be used to authenticate your API Request on our servers

Here is what the API request will look like as an href link that you can execute in your web browser (simply replace the variable information):

https://www.3drepo.io/api/teamsapce/model/revision/master/head/meta/all.json?key=APIKey

Setup Power BI

Open up the sample Power BI Template or create a new one. In Power BI click on the Transform Data icon highlighted below.

New Window will appear containing 3 parameters API Key, Teamspace and Model ID in the Queries tab (if using a template). You will be required to select each individual parameter and copy & paste the information from 3D Repo into the Current Value field. See image below

Query Parameters

If you aren't using the sample template, then you will need to create these parameters in Power BI. It's simple, just right-click in the Queries tab and select New Parameter. Give it a name and ensure that you untick the Required box.

New Web Query

Once you have provided all of the relevant information in the Parameter fields we will use them to fill in the variables in our API call. In the Queries, tab right-click with your mouse select New Query > Web.

A new window will appear called From Web. We're going to use the following URL link for our API request:

https://www.3drepo.io/api/teamsapce/model/revision/master/head/meta/all.json?key=APIKey

Since some parts of the URL link contain variable information such as teamspace, model & APIKey, select the Advanced option as shown below and do the following to build your URL link (when done click OK):

  1. Provide parts of the URL link as a string value

  2. For some parts of the URL link select your variable parameters

  3. Keep adding parts if required to build out your URL link

If the Access Web content window appears on your screen, make sure you select the top-level URL https://www.3drepo.io/ and click Connect.

Transform JSON data response

Your new API Request will appear in the list of queries of the Queries panel. You can rename your query accordingly and work with it further. Since the response from our servers is a JSON body schema, you will need to take a few additional steps in Power BI to convert it into a readable table.

The power is in your hands, so you can navigate down the data list of your Query source as shown below. Simply click on the List in the Data row > Convert to Table.

Once you're done with the table transformation click on the Close & Apply icon in the top left corner of the Home tools ribbon.

Change API Variables

At any moment in time you can change your API variable values should you choose to retrieve information for other models, projects or Teamspaces.
Open the drop-down list of the Transform Data icon and click on the Edit Parameters.

A new window will appear called Edit Parameters. There you can change current values for API Key, Teamspace & Model ID to link with other models in 3D Repo.
If you want to pull the latest results from 3D Repo, click on the Refresh icon (next to Transform Data).

Did this answer your question?