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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Get refresh history in group

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,

1 ACCEPTED 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.

View solution in original post

12 REPLIES 12
palamanb_Risk
Frequent Visitor

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.

amitchandak
Super User
Super User

@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/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
lbendlin
Super User
Super User

You are not saying what you are using to initiate the calls. Is this Powershell, Power Query, Power Automate?

Anonymous
Not applicable

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. 

Anonymous
Not applicable

OK thanks i will try this and give you a feedback thantks a lot !

Anonymous
Not applicable

Hi back,

 

I still have acces forbidden 😢  (see my screen below)

Urba34_0-1597921911101.png

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.

Anonymous
Not applicable

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?

Anonymous
Not applicable

Sorry but i really don't know how to do that maybe with a loop ? or a Python Script ?

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors