Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
kaym
Helper I
Helper I

How to get data from ASP.NET API into power BI

Your question provides a good overview of the problem you're facing, but it could be a bit more specific to help others understand the issue better. Here's a revised version of your question that adds some additional detail:


Hello Power BI Community,

I'm having trouble accessing data from an API in Power BI. The API is a GET endpoint, and I need to pass filters to retrieve the data. The developer informed me that the API only supports basic authentication and provided me with an encoded user credential.

Specifically, I'm uncertain about how to:

  1. Construct the URL in Power BI to include the filter parameters.
  2. Add basic authentication using the provided encoded user credential.
  • Filter parameters:

{
  "WorkCenter": 1,
  "WorkCenterCode": "sample string 1",
  "StartDate": "2024-01-30T12:39:44.6483715-05:00",
  "EndDate": "2024-01-30T12:39:44.6483715-05:00"
}

The URL looks something like this (omitted a few details in the URL fro confidentiality):
https://operations.example.com/rest/Help/Api/GET-api-zero-equipmentdowntime-reportrawdata_workCenter...

I have no idea how to go about it and any help and guidance would be extremely appreciated.





Any guidance on how to set up the query in Power BI to retrieve data from this API would be greatly appreciated.

Thank you!

1 REPLY 1
v-yifanw-msft
Community Support
Community Support

Hi @kaym ,

Based on the details you have provided, it appears that you need guidance on building URLs with filter parameters, adding basic authentication, and setting up queries in Power BI. Let us address each of these in turn.

 

1. To include filter parameters in an API call, you typically need to append them to the URL as query parameters. Since the API is a GET endpoint, you can format the URL this way:

https://operations.example.com/rest/Help/Api/GET-api-zero-equipmentdowntime-reportrawdata_workCenter?WorkCenter=1&WorkCenterCode=sample%20string%201&StartDate=2024-01-30T12:39:44.6483715-05:00&EndDate=2024-01-30T12:39:44.6483715-05:00

For more information on building URLs with filters in Power BI, see the following:

Filter a report using query string parameters in the URL - Power BI | Microsoft Learn

 

2. To perform basic authentication using encoded user credentials, you can follow these steps in Power BI:

  • When connecting to the API, select the Web source from the Get Data option.
  • Enter the API URL and select the Advanced option.
  • Add a new header under "HTTP Request Header Parameters". The key should be 'Authorisation' and the value should be 'Basic <your_encoded_credentials>'.

Best Regards,

Ada Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.