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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Panto
Helper I
Helper I

Dynamically control the Rest API URL for datasource "from Web" based on user input/interaction

Hi Community,

 

I was looking to rely on data coming from REST API using the "From Web" option in the Get Data menu.

 

It's something really useful and I really like the advanced option which allow you to add part to the selected URL.

 

Anyway, from what I see, you can just type the "additional URL part" and there's no way to change it via user interaction.

2020-11-25 17_35_47-Window.png

In the example, my REST API accepts a parameter (employee ID 23), but as far as I undertand, once the report loads data the first time, all my data will always be related just to ID 23 and there's no way for the final user to trigger a new request in order to get data from another ID.

 

Am I right, or am I just missing anything?

 

Thanks in advance.

 

 

Fabio

Follow me on Twitter:@PantoMvp
Get in contact on Linkedin: Fabio Fantoni
1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hi @Panto ,

 

Do you want to use filters or slicers to set the value(s) for an query parameter? You can refer to the preview function: https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-dynamic-m-query-parameters.

 

Since it is a preview version, so it has many limitations and may not have good technical support. 

 

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

 

Best Regards,

Dedmon Dai

View solution in original post

7 REPLIES 7
Panto
Helper I
Helper I

Hi Dedmon,

 

this sounds something more like what I'm thinking of.

 

I will try it and let you know.

 

Thanks in advance.

 

 

Fabio

Follow me on Twitter:@PantoMvp
Get in contact on Linkedin: Fabio Fantoni
v-deddai1-msft
Community Support
Community Support

Hi @Panto ,

 

Do you want to use filters or slicers to set the value(s) for an query parameter? You can refer to the preview function: https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-dynamic-m-query-parameters.

 

Since it is a preview version, so it has many limitations and may not have good technical support. 

 

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

 

Best Regards,

Dedmon Dai

v-deddai1-msft
Community Support
Community Support

Hi @Panto ,

 

You can create a parameter first(I have will show the steps by my test api):

1.png

 

Then you can use parameter for getting data from web:

 

2.png 

 

After publishing the report to the power bi service , you can change the parameter in :

 

Capture2.PNG

 

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

 

Best Regards,

Dedmon Dai

Hi Dedmon,

 

the solution I am looking for is soemthing that allows the final user of the report (may be someone with basic and non-admin profile) to dynamically change the value of that sepcific paremeter (can be more than one) only within the report published on PBI service.

So basically, he/she opens the report with a "default value" retrieved from the REST API, and then without anything else but the report itself, he/she has "something" to click on / interact with in order to change that parameter and retrieve new data.

 

Best

 

Fabio

Follow me on Twitter:@PantoMvp
Get in contact on Linkedin: Fabio Fantoni
PhilipTreacy
Super User
Super User

Hi @Panto 

As an alternative, you could load a value from (for example) an Excel file.  This value would be the Student ID.  But this method requires you to use Power Query in Excel rather than PBI.

Happy to show you how to do it if you want?

Regards

Phil


If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


PhilipTreacy
Super User
Super User

Hi @Panto 

You can create a Parameter from the Manage Parameters icon in the PQ menu.

This will allow you to specify a parameter/value that can be added to the URL.  As this parameter value is changed so the data returned by your Web request changes.

 

Here's a sample PBIX file demonstrating the procedure below.

 

For example click on Manage Parameters and then New Parameter

manage-param.png

 

Fill in the details for the new parameter

new-param.png

 

After you click OK you will have a new parameter called StudentID listed under the queries on the left of the screen and you should see this

param-value.png

 

Now open your main query in the Advanced Editor, the source step should look something like this

 

Source = Web.BrowserContents("https://www.api.com/employee/")

 

 

Change it so it looks like this

 

Source = Web.BrowserContents("https://www.api.com/employee/"&Text.From(StudentID)),

 

 

Close the query and then click on the StudentID parameter query.

Change the value of the parameter, then click back on the main query.  It should load the data associated with the Student ID you just entered as the parameter value.

Regards

Phil


If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hi Philip,

 

thanks for your feedback.

 

I've already tried somethig similar and since I cannot download your sample pbix, let me add one additional info.

"After" Power BI Dekstop, what I need is something that once published on PBI service may allow the final user of the report to change the parameter several times.

 

Example: by default we can have an ID set to 1, but I need the final user to change the ID via interaction with the report, say first change happens because he/she selects ID=2 via parameter, and after that he/she selects ID = 4.

 

Do you think it's possible?

 

Thanks again.

 

 

Fabio

Follow me on Twitter:@PantoMvp
Get in contact on Linkedin: Fabio Fantoni

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.