New Data Studio feature: Linking API

New management possibilities for your dashboards. By Alexander Junke

Bildschirmfoto 2022-08-22 um 22.54.56.png

Photo by Fahrul Azmi on Unsplash

We always felt that Data Studio was really lacking possibilities to set up automation. Data Studio had just an API to handle the permissions for reports and data sources, but no additional APIs to interact directly with dashboards.


Google published a new API for Data Studio to improve the handling of dashboards for editors and viewers. In this post, we want to investigate the Linking API and the offered possibilities.

Everybody who is interested in new Data Studio features has to read this post.

The URL structure

The Linking API can be managed just by building an URL. The URL always has the same path and all of the customizations are made in the parameters.
 

The path is always:

https://datastudio .google.com/reporting/create

 

After the path, you can add the parameters to customize the experience of the user of the dashboard or change the dashboard itself. 

Change the report settings

There are some standard parameters you can add to the Linking URL. These are also called control parameters:

 

So a possible URL would be:

https://datastudio.google.com/reporting/create?c.reportId=ca5902da-ad31-1z34-13f8-98ec5f3ad950&c.pageId=p_xu283kdkwl&c.mode=edit

There is currently one setting for the report you are sharing:

  • r.reportName: Set the name of the report (If unspecified: Template Report Name - Date, Time)

Workflow of the Linking API

When you click on one of these prepared links, at first you see the report with the selected page, in the selected mode and you can work with the dashboard already. Additionally at the top right corner is a “Save and share” button.

Bildschirmfoto 2022-08-22 um 22.55.05.png

After clicking on this button a new menu for setting up the data sources appears.

Bildschirmfoto 2022-08-22 um 22.55.13.png

You see the connected data sources and more information about the different connector settings (e.g. for BigQuery data: project, dataset, table, …). Furthermore, you can edit the data source, change fields, reconnect to another source, and more. 

 

When you click then the “Acknowledge and save” button, a new report gets created with all the settings you have chosen.

Switch the Data Sources

Set up Data Sources

You can change the data source settings by creating the new dashboard from the template. But it is also possible to do adjustments already with the “programmed” URL. 

 

For the shared dashboard you can also replace or update the connected data sources. The settings for the different connector types are highly different. Due to that, we are focusing on the connector we have the most experience with, Google BigQuery.

 

The data source parameters for a BigQuery source you can add to the URL are the following:

  •  ds.alias.datasourceName: The name of the data source

  •  ds.alias.connector: The connector you want to use (in our case BigQuery)

  •  ds.alias.projectId: The id of the GCP project you want to connect

  •  ds.alias.type: which type of data it is (e.g. TABLE)

  •  ds.alias.datasetId: The id/name of the dataset you want to connect

  •  ds.alias.tableId: The id/name of the table you want to connect

 

The following connectors are currently supported by the Linking API:

  • BigQuery

  • Cloud Spanner

  • Google Analytics

  • Google Cloud Storage

  • Google Sheets

  • Google Surveys

  • Search Console

The data source alias

The missing part is the alias of the data source. In the previous weeks, you might have already recognized the alias next to the data source.

Bildschirmfoto 2022-08-22 um 22.55.20.png

Alias of the data sources

Every data source has an id attached which always starts with “ds” and then a random number behind. To change the data source settings for the new report, you have to use the alias of the template's data source in the final URL.


An example URL with changing the data source would be:
https://datastudio.google.com/reporting/create?c.reportId=ca5902da-ad31-1z34-13f8-98ec5f3ad950&c.pageId=p_xu283kdkwl&c.mode=edit&ds.ds334.datasourceName=changeddatasource&ds.ds334.connector=bigQuery&ds.ds334.projectId=project-123&ds.ds334.type=TABLE&ds.ds334.datasetId=marketing_data&ds.ds334.tableId=daily_channels

Error in the configuration

If there is an error in your URL you also get an error message.

Bildschirmfoto 2022-08-22 um 22.55.25.png

In this case, the value of the type parameter is wrong. It should be TABLE.

Conclusion

Google improved with this API the way of duplicating and sharing dashboards and changing during the process the most important configurations. The idea is to build template reports and create custom reports out of these, with their own report settings and other data source connections.

Further Links

This post is part of the new features in the Google cloud series from datadice and gives you detailed insights about a new feature in BigQuery or Data Studio.

 

Check out our LinkedIn account, to get insights into our daily working life and get important updates about BigQuery, Data Studio and marketing analytics

 

We also started with our own YouTube channel. We talk about important DWH, BigQuery, Data Studio and many more topics. Check out the channel here.

 

If you want to learn more about how to use Google Data Studio and take it to the next level in combination with BigQuery, check our Udemy course here.

 

If you are looking for help to set up a modern and cost-efficient data warehouse or analytical dashboards, send us an email to hello@datadice.io and we will schedule a call.