Craft.io has a set of APIs which exposes a lot of data about your workspace’s working items. You can bring this data into your database or directly into your visualization tool.
Here we will show you how to connect to Craft.io APIs and bring your workspace’s data into Microsoft Power BI.
(*) It's important to note that this integration is a suggested approach and may require customization based on your specific requirements. Craft.io does not guarantee seamless out-of-the-box support for every use case. Users are advised to use these suggestions at their own discretion, considering their unique system configurations and requirements.😊
Pre-requirements
To import your workspace data into Power BI via an API request, it's essential to have the following information readily available:
Your Craft.io account ID
Your Craft.io workspace IDs
Your account's API Key
To obtain this type of information, please reach out to your Customer Success Manager. They will be able to provide you with the necessary details.
Power BI
Bring in the tables!
In a new Power BI Desktop file, click on “Get data” > Web
Choose “Advanced” option and then enter the details:
URL parts: https://api.craft.io/workspace/<workspace_id>/items?fields=<list> &limit=<number>
Accept: application/json
x-api-key: The API key from Pre-requirements
A “Power Query Editor” will open. Click on “List” > “To Table” > expand “Column1"
In the window that appears, bring only the necessary columns (include “customFields”), and un-mark this option: "Use original column name as prefix".Name this table as “Working Items”.
Change column types and names as needed; expand nested json object when necessary (do not expand “customeField”, we will expand it in a separate table).
Repeat steps 1-3 with the following data:
Create table “Map of Custom Fields”, using this URL: https://api.craft.io/workspace/<workspace_id>/custom_fields
Create table “Terminology”, with this URL: https://api.craft.io/workspace/<workspace_id>/terminology
How to open Terminology table:
Create “Custom Field” table by following these steps:
Right click “Working Items” table on the left panel → Reference
Rename the new table “Custom Fields”
Use “Choose columns” to keep only columns “id” and “customFields”
Rename “id” to “item id”
Expand “customFields” and keep all columns. pay attention that some of the less-commonly used columns might be found in "load more" when choosing which columns to expand.
If you have configured in your Craft.io workspace a custom field of type multi-value picklist, you will have a "values" column available. Expand this column and choose a comma-separated delimiter
Merge and connect the tables
Custom Fields table: Expand "custom fields” column to new rows, and then expand again to “id” and “value”. Add “custom field name” column from the “Map of Custom Fields” table to the “Custom Fields” table:
In the table “Custom Fields”, click on Combine > Merge Query.
Merge the two tables based on “Custom Fields” customFields.id = “Map of Custom Fields” id. Bring only the “name” column from “Map of Custom Fields” table. After doing so, you will not need the “Map of Custom Fields” table, and you can hide it from view (In Model View, click on the eye next to the table name).
Many interesting questions and KPIs can be asked about the item’s parent, so adding parent’s data to the table can be useful. Do this by Self-join: In “Working Items” table, click on Combine > Merge Query.
Then merge based on id = parent.id.
bring only the columns you need from the Parent.
Connecting the tables: “Working items”.id = “Custom Fields”.id; “Working items”.type = “Terminology”.Name
Create a report for another workspace
Do you have multiple Craft.io workspaces and want to create separate reports for each of them?
To create a report for another workspace, start by duplicating the report you've previously created in the earlier section.
In the "Transfer Data" section of the duplicated report, you'll need to make some adjustments to ensure the data is pulled from the new workspace. Follow these steps for each your tables:
For each table, modify its source to match the new workspace ID (and key, if necessary).
In the case of the "Custom Field" table, not only should you change the source reference table but also the merge table from which you're pulling the field "Name" (the "Map of custom field" table).
By following these steps, you can easily generate reports for multiple Craft.io workspaces, ensuring that the data is tailored to each workspace's specific requirements.
Video tutorial