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! Learn more

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

10 REPLIES 10
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
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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 Kudoed Authors