Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello Folks,
I hope you doing well, i'm trying to use this api
https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/getrefreshhistoryingroup
The demo mode rocks ! So it's cool but at the end of the day when i have create the app with all the right needed and when i try to use this api in Power BI i have the message : "Acces forbidden "
I have tried to :
Connect with Microsft Credidentials
Connect With Application ID
Connect With Application ID + token
I would like to know how to authentifacte for using this Api
Thanks a lot,
Regards,
Solved! Go to Solution.
Here is my code, see if you can spot any differences.
let
group = "d9db3715-2ae7-4aa1-aa44-xxx",
dataset = "9941f7c0-e07e-4382-959c-xxx",
auth = "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOi-xxx",
Source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/groups/" & group & "/datasets/" & dataset & "/refreshes", [Headers=[Authorization=auth]])),
value = Source[value],
#"Converted to Table" = Table.FromList(value, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id", "refreshType", "startTime", "endTime", "status", "requestId", "serviceExceptionJson"}, {"id", "refreshType", "startTime", "endTime", "status", "requestId", "serviceExceptionJson"})
in
#"Expanded Column1"
I also use Anonymous as the login type.
I am very happy to see the solution worked out for some one ! Can any one suggest me how I can use a rest API to pull the refresh history for all the workspaces and the datasets as I am the power bi admin . when I said to pull the refresh the data , I want to create a power bi report using API - If I can get answers for this , I apriciate the help - Thanks
Use Miguel Escobar's Power BI REST API connector - it has that call built in. GitHub - migueesc123/PowerBIRESTAPI: A Microsoft Power BI Data Connector or Power Query Connector fo...
NOTE: Currently the call fails if you have more than 10500 refresh entries. We have a ticket open with Microsoft about that.
@Anonymous , refer if these can help
https://windowsreport.com/access-to-resource-forbidden/
https://www.spguides.com/access-to-the-resource-is-forbidden-power-bi/
You are not saying what you are using to initiate the calls. Is this Powershell, Power Query, Power Automate?
Thanks for you quick reply
I'm using power query
Regards,
You can run your regular API calls in Power Query, like so :
let
Source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/gateways/" & GatewayId & "/datasources", [Headers=[Authorization=Authorization]])),
value = Table.FromList(Source[value],Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(value, "Column1", {"id", "gatewayId", "datasourceType", "connectionDetails", "credentialType", "credentialDetails", "datasourceName"}, {"id", "gatewayId", "datasourceType", "connectionDetails", "credentialType", "credentialDetails", "datasourceName"}),
...
You can obtain the Authorization token manually (I usually just copy it from the API sandbox) or you can register an app and use the app's token.
OK thanks i will try this and give you a feedback thantks a lot !
Hi back,
I still have acces forbidden 😢 (see my screen below)
What i'm doing wrong ? What credentials i have to put ? I try Anonymous because all id comming from the url so .. idk
Thanks a lot 🙂
Regards,
Here is my code, see if you can spot any differences.
let
group = "d9db3715-2ae7-4aa1-aa44-xxx",
dataset = "9941f7c0-e07e-4382-959c-xxx",
auth = "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOi-xxx",
Source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/groups/" & group & "/datasets/" & dataset & "/refreshes", [Headers=[Authorization=auth]])),
value = Source[value],
#"Converted to Table" = Table.FromList(value, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id", "refreshType", "startTime", "endTime", "status", "requestId", "serviceExceptionJson"}, {"id", "refreshType", "startTime", "endTime", "status", "requestId", "serviceExceptionJson"})
in
#"Expanded Column1"
I also use Anonymous as the login type.
It's WORKING !!!!!!!!
MAN YOU SAVE MY DAY !!
Thanks a lot ❤️
Good to hear. What I don't know (but would like to) is to how to harvest the auth token automatically from within the same Power Query script. I have tried many different things already but so far no luck. Any idea?
Sorry but i really don't know how to do that maybe with a loop ? or a Python Script ?
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!