Blog

How to read data from a REST API to Power BI – using Swedish central bank data as example

In this blog post, we are going to go behind the scenes of the development of two reports available in our Portfolio. These reports read data from the Swedish central bank – the Riksbank – directly to Power BI. We do so by utilising the REST APIs provided by the Riksbank. REST API stands for REpresentational State Transfer API, and it is a common way of structuring and accessing data in a programmatic way.

Background on REST APIs

Some REST APIs have security measures in place, so that only authorised users can access the data. The user then has to send credentials by using the API, and if they are verified correctly, data can be read. With the Riksbank’s API it is not required with credentials. Hence, this guide is going to skip that part, and we are only reading, not writing, data when using the API. We are going to access interest rates for the SWESTR which is a reference rate with short duration (overnight rate). For more information about SWESTR, please see the Riksbank’s website.

How to read data from a REST API to Power BI

The user starts by going to Get data in Power BI. It is going to look like this, and then the user selects “Web” in the list.

Get Data Power BI

From the Riksbank’s website, we see that the request to get all the interest rate values is:

https://api.riksbank.se/swestr/v1/all/{interestRateId}?fromDate={fromDate}[&toDate]

We also read that interestRateId = SWESTR shall be used and we set fromDate = 2023-01-01. The toDate is optional, as indicated by [], and we skip it. It will then read all the data up until today. The request will look like:

https://api.riksbank.se/swestr/v1/all/SWESTR?fromDate=2023-01-01

We simply add that to the URL requested in Power BI.

Read data from REST API to Power BI

The user gets the data from 1st January 2023 in return. Each row of the data is the data for that day, for example the interest rate and the volume during that day.

Data has been read from the Riksbank's REST API to Power BI

The data connection is now established, and it is now easy to refresh by a single click in Power BI.

For more information about the APIs provided by the Riksbank, please see their documentation.

More blog posts

On the development of SWESTR in May 2024

We analyse the development of the SWESTR in May 2024. We use a Power BI report and also review the...

On the development of the SEK exchange rates & bond yields in May 2024

We analyse the development of the SEK exchange rates & bond yields in May 2024. We use a Power BI...

On the development of the SEK exchange rates & bond yields in April 2024

We analyse the development of the SEK exchange rates & bond yields in April 2024. We use a Power BI...

On the development of the NOK exchange rates & bond yields in March and Q1 2024

We analyse the development of the NOK exchange rates & bond yields in March and Q1 2024. We use a...

On the development of SWESTR in March and Q1 2024

We analyse the development of the SWESTR in March and Q1 2024. We use a Power BI report and also...

On the development of the SEK exchange rates & bond yields in March and Q1 2024

We analyse the development of the SEK exchange rates & bond yields in March and Q1 2024. We use a...

On the development of the SWESTR in February 2024

We analyse the development of the SWESTR in February 2024. We use a Power BI report and also analyse...

On the development of the NOK exchange rates & bond yields in February 2024

In this blog post, we will analyse the development of the NOK exchange rates in February 2024. We...

On the development of the SEK exchange rates & bond yields in February 2024

We analyse the development of the SEK exchange rates and bond yields in February 2024. We use a...