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
Anonymous
Not applicable

Invoke-powerbirestmethod runs in "Unsupported media type" error

I runs powershell script to retrieve powerbi dataset refresh history. 

(guid is sample only)

$token="/datasets/2bbf1c0d-c2bc-46e3-8eed-576320930443/refreshes"
$dsu=Invoke-PowerBIRestMethod -url $token -Method Get |ConvertFrom-Json |select-object -expand value

 

Most dataset I filled as guid run successfully. 

However, only a few of them runs in following red error,

Invoke-PowerBIRestMethod : One or more errors occurred.
At line:2 char:11
+ $dsu=Invoke-PowerBIRestMethod -url $token -Method Get -ContentTy ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Power...werBIRestMethod:InvokePowerBIRestMethod) [Invoke-PowerBIRestMethod], AggregateException
+ FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod

 

With "resolve-powerbierror -last", I get following error message

Message : Response status code does not indicate success: 415 (Unsupported Media Type).
StackTrace : at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod.<InvokeRestMethod>d__31.MoveNext()
Exception : System.Net.Http.HttpRequestException
InvocationInfo : {Invoke-PowerBIRestMethod}
Line : $dsu=Invoke-PowerBIRestMethod -url $token -Method Get 
Position : At line:2 char:11
+ $dsu=Invoke-PowerBIRestMethod -url $token -Method Get 

 

I doubt it's permission error but no evidence.

 

Could someone share lights on it and give me any clues please?

 

Regards,

Sean

7 REPLIES 7
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

You have two options. You can go into the service and look at the refresh history in the dataset settings. Or you can use the Power BI API to get the refresh history

https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/getrefreshhistory

You'll need to get the steps of: 1) Get list of the workspaces 2) Get list of datasets 3) Get the refresh history

You'll have to code an iterative process that loops through stages 1 & 2 to get the detail on all the datasets.

And an e-mail will be sent in case of refresh failure. Make sure the checkbox Send refresh failure notifications to dataset owner is selected (assuming you are the dataset owner) when configuring the scheduled refresh. You can also specify additional recipients for these notifications.

 

Best Regards

Lucien

The URL suggested only get history from the users "MyWorkspace", which probably does not address orginal  question .

Anonymous
Not applicable

Hi Luwang, 

Thanks for quick reply. 

That's what I did currently, api "get refresh history" runs failed for cache refresh.

That's the point.

 

Dedicator

Anonymous
Not applicable

I think I know what's happened. 

All those refresh errors come from those "cache refresh".

The key is that api can't get cache refresh history from Power BI.

 

New problem occurrs: How to get power bi data set cache refresh history?

 

 

v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

This similar thread pointed that such an error might be caused by the cached data from OData feeds in Power BI desktop. Please check if the provided solutions apply to your scenario.

 

Read the following article,wish it is helpful for you!

Unsupported Media error XML response

API error 415: Unsupported Media Type

Power BI desktop gives error (415) Unsupported Media Type with only certain OData feeds from NAV

 

 

Best Regards

Lucien

Anonymous
Not applicable

Hi Lucien, 

Thanks for the help. 

However, the server running powershell script does not install Power BI desktop.

I use powershell to connect powerbi on cloud and got that error.

So I think that's not the problem.

But anyway, thanks again.

 

Regards,

 

DEDICATOR

Anonymous
Not applicable

Hi,

 

Did you ever resolve this as I am having the same issue.

 

Thanks.

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.

Top Solution Authors
Top Kudoed Authors