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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

dataflow refresh using api failed - 400 bad request

Hi there,

 

I am trying to refresh dataflows using the rest api: https://docs.microsoft.com/en-us/rest/api/power-bi/dataflows/refreshdataflow

 

And I am getting the following error:

Invoke-RestMethod : The remote server returned an error: (400) Bad Request.
At line:2 char:1
+ Invoke-RestMethod -Uri $uri –Headers $authHeader –Method POST –Verbos ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

 

The code:

function GetAuthToken
{
if(-not (Get-Module AzureRm.Profile)) {
Import-Module AzureRm.Profile
}

$redirectUri = "urn:ietf:wg:oauth:2.0:oob"



$authContext = New-Object "Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext" -ArgumentList $authority

$authResult = $authContext.AcquireToken($resourceAppIdURI, $clientId, $redirectUri, "Auto")

return $authResult
}

$token = GetAuthToken

$authHeader = @{
'Content-Type'='application/json'
'Authorization'=$token.CreateAuthorizationHeader()
}
$groupsPath = ""
if ($groupID -eq "me") {
$groupsPath = "myorg"
} else {
$groupsPath = "myorg/groups/$groupID"
}

Invoke-RestMethod -Uri $uri –Headers $authHeader –Method POST –Verbose
Status: New
Comments
SimonL7
Regular Visitor

I am not sure is this a bug or not though, I can get dataflow list using same authenticaiton.

 

Anyone have ideas on this issue?

v-qiuyu-msft
Community Support

Hi @SimonL7 ,

 

You need to pass "refreshRequest": "y" in your request body. For more information, please refer to this thread: https://community.powerbi.com/t5/Developer/Power-BI-API-Dataflow-Refresh-Operation/td-p/588556

 

Best Regards,
Qiuyun Yu 

mikesmith_bp
Frequent Visitor

I am getting the same error.  I am refreshing a dataflow via Power Automate.  It works fine for several refreshes.  Then it just seems to randomly "break" with error

The backend request failed with error code '400'

 

I also tried this on my co-workers cloud and had the same results. 

My dataflow does have a web call in it.  But why would it work and then break?

Anonymous
Not applicable

I get the same error since 07-Sep
I exported the DS to a new WS
After successful execution, it randomly breaks throwing The backend request failed with error code '400'

Please, it is important to solve the problem because it depends on the intervention to end the flows

Anonymous
Not applicable

I m having the same error when I try to trigger a Dataflow refresh via PowerAutomate

Action 'Refresh_a_dataflow' failed
The backend request failed with error code '400'

Its very random and there is no addiotnal information to debug. Anyone you can help here?

All the below failed status are due to the same reason :

SamRock_0-1631719186040.png

 

Zaid9595
Regular Visitor

@Anonymous I am facing the same problem and i cant solve it, did you find the solution???

mikesmith_bp
Frequent Visitor

I have not found a solution.  In my experience, the Power Platform is not 100% reliable.  I see 'weird' errors like this all of the time.