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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
kanth999
Helper I
Helper I

Call any Power BI REST API with PowerShell issue

@ links to members

 

I am trying to refresh the PoweBI dataset from PowerBI rest API using Powershell getting below error can you please help me how to fix the issue

using command 

 

 

Invoke-PowerBIRestMethod -Url "datasets/19b9e00-e8f2-4f81-baae-e2ee907af256/refreshes" -Method Post

 

getting error 

 

Invoke-PowerBIRestMethod: One or more errors occurred. (Response status code does not indicate success: 404 (Not Found).)

 


  1. Note: i am running this command on Mac 
2 REPLIES 2
pvuppala
Helper IV
Helper IV

You're missing some syntax.  Here's what works for me.

 

 

$body = "{`n `"notifyOption`": `"MailOnFailure`",`n}"
$headers = Get-PowerBIAccessToken
$headers.Add("Content-Type", "application/json")

Try
{

$data_refresh= Invoke-RestMethod -Uri 'https://api.powerbi.com/v1.0/myorg/groups/GROUPID/datasets/DATASETID/refreshes' -Method 'POST' -Headers $headers -Body $body
Write-Host "Refresh Completed! " -ForegroundColor "Green";

}
Catch
{
Write-Host "Failed to Refresh Data! " -ForegroundColor "Red";
Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__
Write-Host "StatusDescription:" $_.Exception.Response.StatusDescription
}

Hi,

 

thanks for your reply , 

I am using MAC OS and installed the Powershell  Install-Module -Name MicrosoftPowerBIMgmt command when i try lo login powerbi getting this issue and also when i execute the above commands not able to run getting issue of below 

 

 

any idea how we can use 

Microsoft Power BI Cmdlets for Mac PowerShell and PowerShell Core

kanth999_0-1650587178578.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors