migueesc123 / PowerBIRESTAPI

A Microsoft Power BI Data Connector or Power Query Connector for the Power BI REST API
MIT License
234 stars 74 forks source link

Get Data with {report id} #86

Closed detrickm closed 2 years ago

detrickm commented 3 years ago

How can I get a listing of all users for all report ids using the following API? https://api.powerbi.com/v1.0/myorg/admin/reports/{reportId}/users

I would like to gather this listing without providing a report id in the parameter to run for all report id?

Similar to how the Workspaces Users is working in the connector using the https://api.powerbi.com/v1.0/myorg/groups/{groupId}/users

migueesc123 commented 3 years ago

Just checked the code for the connector and I don't see a query for that specific endpoint. You could first use one of the other tables to get the "ReportIDs" and then run the GetData function against those IDs.

I'm leaving this one open in case @ImkeF or @klinejordan have any other comments, suggestions or would like to add that functionality to the connector.

klinejordan commented 3 years ago

This (and the GetDatasetUsersAsAdmin, GetDataflowsUsersAsAdmin, GetDashboardUsersAsAdmin, etc) are brand new API that's still in preview - they came out on 9/10.

I haven't evaluated its performance at all and would be extremely surprised if it performed well in large tenants given the size of the payload that'll come back and the 200 calls per hour limitation they have. This should be treated as an enhancement request but like I said this is probably going to behave like the GetDatasetDatasourcesAsAdmin API - slowly.

detrickm commented 3 years ago

Thanks @migueesc123 I was able to create a table with the ReportIDs but i was not quite sure how to input it in the GetData function to produce a table for all ReportIDs. Do you have any recommendations or examples as to how i could input this?

migueesc123 commented 3 years ago

assuming that you have the column that has the IDs, something like: FunctionName("admin/reports/"&[ID Column] &"/users")

should do the trick

migueesc123 commented 3 years ago

Forgot to mention that the function itself (GetData) does provide an example and some documentation on how it works. Just in case, that function is in the "Functions" folder.

klinejordan commented 3 years ago

You can also get this information from the scanner API: https://powerbi.microsoft.com/en-us/blog/scanner-api-is-now-in-ga/

But this connector is unlikely to ever use the scanner API because M is not the greatest language for handling polling in APIs.

detrickm commented 3 years ago

Thanks again @migueesc123 and @klinejordan for your very fast responses!

cool-Blue commented 2 years ago

@migueesc123 tank you for this! Sorry for the dumb question: where is the "Functions" folder?

migueesc123 commented 2 years ago

@migueesc123 tank you for this! Sorry for the dumb question: where is the "Functions" folder?

You should be able to see it in the navigator window. There should be a little folder icon with the name "Functions". You can also see a screenshot of how the navigator looks like in the main page of this repo.

cool-Blue commented 2 years ago

You should be able to see it in the navigator window. There should be a little folder icon with the name "Functions". You can also see a screenshot of how the navigator looks like in the main page of this repo.

Thanks @migueesc123, I missunderstood. I saw the example in the function metadata but, was looking for more info. I thought you meant there was more detailed documentation somewhere (here in the repo for example). I will try to read the code. All good! OK, I figured it out, would it be OK for me to add a section to your wiki with more detailed instructions?

Krishna1805 commented 2 years ago

@cool-Blue Could you please share the details how did you figured it out. I have the Report ID's in one table and how would I apply these ID's on the below API to get the users of all the report IDs https://api.powerbi.com/v1.0/myorg/admin/reports/{reportId}/users