cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mattcarter865
Helper I
Helper I

Some REST API calls return status 405 using PowerShell

I'm testing the waters with some REST calls for Power BI. I'm using the PowerShell cmdlets. I can successfully make calls to some api endpoints for example listing the refresh history of a dataset

Datasets - Get Refresh History In Group - REST API (Power BI Power BI REST APIs) | Microsoft Docs

 

But others return an error even though I am following the documentation. For example,

Datasets - Cancel Refresh In Group - REST API (Power BI Power BI REST APIs) | Microsoft Docs

Invoke-PowerBIRestMethod -Method Delete -Url 'groups/xxxxx-xxxx-xxxx-xxxx-xxxxxc54c/datasets/xxxxxx-xxx-xxxx-xxxx-xxxxxx2bb0f/refreshes/xxxxxx-xxxx-xxxx-xxxx-xxxxx5b444'
 Message : Response status code does not indicate success: 405 (Method Not Allowed).
StackTrace : at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod.<InvokeRestMethod>d__35.MoveNext()
Exception : System.Net.Http.HttpRequestException
InvocationInfo : {Invoke-PowerBIRestMethod}
Line : Invoke-PowerBIRestMethod -Method Delete -Url .....
Position : At line:1 char:1
+ Invoke-PowerBIRestMethod -Method Delete -Url 'groups/9bbe36b5-cb03-4e ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

 I had similar error trying to invoke

Datasets - Get Refresh Execution Details In Group - REST API (Power BI Power BI REST APIs) | Microso...

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @mattcarter865 ,

Both of the following REST APIs are only for datasets that perform asynchronous refresh operation operations:

There are the following limitations for asynchronous refresh with the Power BI REST API, that is probably the reason for getting 405 error...

yingyinr_0-1646383798059.png

HTTP Error “405 Method Not Allowed”: How to solve the problem

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yiruan-msft
Community Support
Community Support

Hi @mattcarter865 ,

Both of the following REST APIs are only for datasets that perform asynchronous refresh operation operations:

There are the following limitations for asynchronous refresh with the Power BI REST API, that is probably the reason for getting 405 error...

yingyinr_0-1646383798059.png

HTTP Error “405 Method Not Allowed”: How to solve the problem

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.