icon picker
PowerBI & Web API

This page guides how to load your own data in PowerBI through the CarbonSpace API, and create customized visualisations of a carbon assessment. It assumes basic knowledge of PowerBI and PowerQuery, and covers how to load data automatically, but does not cover visualisations in PowerBI.

What is an API?

All data in CarbonSpace is accessible both through the user interface and through a machine-readable interface: the web api.
To customize to your own workflows, CarbonSpace features an open API on which you can build your tools to ensure the right fit. Using you can create API calls for your software, such as PowerBI, Revit, and Grasshopper for Rhino.
The Swagger interface allows testing with the connection.
error
The web API is experimental and may be subject to changes

Step 1: Creating your API key

Under the User header
image.png
Use the GetMe function by clicking on Execute.
image.png
In the response body locate the ID. Your account will have its own ID, for the demo this is 32.
image.png
Use GenerateApiKey to generate your key using the ID from above.
image.png
In the response body you should find your API key. It should look something like user@email.com|{key}

Step 2: Connect PowerBI to CarbonSpace

Upon opening the template you will be prompted for the ApiURL, ApiKey and CalculationID. ​Use the prefilled ApiURL and fill in your API key from step one. You can retrieve the CalculationID from the URL in CarbonSpace when you have a calculation open: https://public.carbonspace.earth/.../calculation/225

In depth: Retrieving Bill of Materials using GetBom in PowerQuery

This power query example shows how to fetch a bill of materials from CarbonSpace with PowerQuery
In the template, you should see three parameters: ApiURL, ApiKey and CalculationID.
PowerQuery will prompt you for Credentials. Use the anonymous access for Web Content applied to

Unpacking the Bill of Materials (BoM)

The below example gets the CalculationLines from the BoM record. The same code should get you the other record items.

Creating relationships between tables

Find the relationships to establish in the table below, as also found in the template.
Key A
Key B
Relationship
Calculation[ProjectId]
Project[Id]
Many to one (*:1)
CalculationProperties[CalculationId]
Calculation[Id]
Many to one (*:1)
CalculationLines[CalculationId]
Calculation[Id]
Many to one (*:1)
CalculationLines[MaterialCategory]
MaterialTypes[Name]
Many to one (*:1)
CalculationLines[MainShearingLayer]
ShearingLayer[Name]
Many to one (*:1)
CalculationLines[TopComponentId]
Components[ComponentId]
Many to one (*:1)
There are no rows in this table

Alternative methods for retrieving multiple calculations at once

GetByOrganisation
Retrieve the organisation ID (aka workspace) using Organisation/GetAll from the Web API page.
GetByProjects
Retrieve the project ID from the web url (https://public.carbonspace.earth/projects/162/...)
GetByCollection
Retrieve the collection ID from the web url. (https://public.carbonspace.earth/projects/162/folder/collection/5)
There are no rows in this table


Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.