Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi all,
I recently created a Function App to call dataset refresh API. The first call succeeded, but every calls after that raised 400 Bad Request.
What is the reason of this error, and how can I fix it?
Thanks,
Diem
Solved! Go to Solution.
@nphdiem95 wrote:
Hi all,
I recently created a Function App to call dataset refresh API. The first call succeeded, but every calls after that raised 400 Bad Request.
What is the reason of this error, and how can I fix it?
Thanks,
Diem
Instead of the simple 400 error, try to output the details error message with try catch block.
$groupsPath ="dc581184-a209-463b-8446-5432f16b6c15" $datasetID = "1f6285a5-7b98-4758-8f81-77b7ae5637d6" $headers = @{} $headers.Add("Authorization","Bearer eyJxxxxxxxxxxxxxxQvNzJmOTg4YmYtODZmMS00MWFmLTkxYWItMmQ3Y2QwMTFkYjQ3LyIsImlhdCI6MTUwNTI3MDA5NSwibmJmIjoxNTA1MjcwMDk1LCJleHAiOjE1MDUyNzM5OTUsImFjciI6IjEiLCJhaW8iOiJZMlZnWUxEOFhTdkt6bXEyc09HSDFINmR4U1p6VXJRVFRrMTIyMjcrYVZWZnZQTVI5dHNBIiwiYW1yIjpbInB3ZCJdLCJhcHBpZCI6IjQ5ZGYxYmM3LWRiNjgtNGZiNC05MWMwLTZkOTNmNzcwZDFhNCIsImFwcGlkYWNyIjoiMCIsImZhbWlseV9uYW1lIjoiWmhhbmciLCJnaXZlbl9uYW1lIjoiRXJpYyIsImlwYWRkciI6IjE2Ny4yMjAuMjU1LjgiLCJuYW1lIjoiRXJpYyBaaGFuZyAoU2hhbmcgSGFpIFdlaSBDaHVhbmcgUnVhbiBKaWFuKSIsIm9pZCI6IjQ3NjgwMTFhLTY2NjgtNGFlNC1hYmYwLTU3NDM2ZGIyODQ1MSIsIm9ucHJlbV9zaWQiOiJTLTEtNS0yMS0yMTQ2NzczMDg1LTkwMzM2MzI4NS03MTkzNDQ3MDctMTg4MDU0NSIsInB1aWQiOiIxMDAzMDAwMDhDMjJBQkRFIiwic2NwIjoiQ29udGVudC5DcmVhdGUgRGFzaGJvYXJkLlJlYWQuQWxsIERhdGEuQWx0ZXJfQW55IERhdGFzZXQuUmVhZC5BbGwgRGF0YXNldC5SZWFkV3JpdGUuQWxsIEdyb3VwLlJlYWQgR3JvdXAuUmVhZC5BbGwgTWV0YWRhdGEuVmlld19BbnkgUmVwb3J0LlJlYWQuQWxsIFJlcG9ydC5SZWFkV3JpdGUuQWxsIiwic3ViIjoiNDQ2MVF0VDh6MGpTdHMxV29lZmVHRk5RMkhMQ1VKcWF6SDVuOEJLWnRVUSIsInRpZCI6IjcyZjk4OGJmLTg2ZjEtNDFhZi05MWFiLTJkN2NkMDExZGI0NyIsInVuaXF1ZV9uYW1lIjoidi1sdnpoYW5AbWljcm9zb2Z0LmNvbSIsInVwbiI6InYtbHZ6aGFuQG1pY3Jvc29mdC5jb20iLCJ2ZXIiOiIxLjAifQ.L5hpKJgcNR4s24ev51El8zWXpb3GGN0_ElyW7XQwpzOHs_CmwoB9M9nddRaih1ZY61dEWjxP8ZCDdWSnzGfxAyOGovgQ3ktEMa5QRiwdgxA3EczeqiaP5DoHRhXSADH8XioeJUWM1dNpiBJ42-Dc_1s4YmQHB4J1dIupMx_iVxThcOPRM-nnE8ikCpDRGzP2uIOMr-MKfPUwcScDDO8fhKItptvhh2R6xFmfvquKRNjU_g0xKtgCIn1bYzwcREA7vYjFeWlt90OLfa9FquoKiU7CggmmJTCotTMlIHKHxkJh2ofxQxX5PSPI6BwMx6UxozornpJbLvZOYhmm6C6RWg") $headers.Add("Content-Type","application/json") $uri = "https://api.powerbi.com/v1.0/myorg/groups/$groupsPath/datasets/$datasetID/refreshes" try{ Invoke-WebRequest -Uri $uri -Headers $headers -Method POST } catch [Net.WebException] { $ex=$_ if ($ex-ne$null) { $resp=$ex.Exception.Response; $rs=$resp.GetResponseStream(); [System.IO.StreamReader]$sr=New-Object System.IO.StreamReader($rs); [string]$results=$sr.ReadToEnd(); Write-Host $results } }
I was in the same situation and this helped me to understand that the error was due to an excessive number of request (more than 😎 in the 24 hours, thanks.
Hi,
I am having the same problem now. I am using c#, now after the first success I get a 400 error every time. How did you solve your problem?
Thanks in advance.
Alexis
@nphdiem95 wrote:
Hi all,
I recently created a Function App to call dataset refresh API. The first call succeeded, but every calls after that raised 400 Bad Request.
What is the reason of this error, and how can I fix it?
Thanks,
Diem
Instead of the simple 400 error, try to output the details error message with try catch block.
$groupsPath ="dc581184-a209-463b-8446-5432f16b6c15" $datasetID = "1f6285a5-7b98-4758-8f81-77b7ae5637d6" $headers = @{} $headers.Add("Authorization","Bearer eyJxxxxxxxxxxxxxxQvNzJmOTg4YmYtODZmMS00MWFmLTkxYWItMmQ3Y2QwMTFkYjQ3LyIsImlhdCI6MTUwNTI3MDA5NSwibmJmIjoxNTA1MjcwMDk1LCJleHAiOjE1MDUyNzM5OTUsImFjciI6IjEiLCJhaW8iOiJZMlZnWUxEOFhTdkt6bXEyc09HSDFINmR4U1p6VXJRVFRrMTIyMjcrYVZWZnZQTVI5dHNBIiwiYW1yIjpbInB3ZCJdLCJhcHBpZCI6IjQ5ZGYxYmM3LWRiNjgtNGZiNC05MWMwLTZkOTNmNzcwZDFhNCIsImFwcGlkYWNyIjoiMCIsImZhbWlseV9uYW1lIjoiWmhhbmciLCJnaXZlbl9uYW1lIjoiRXJpYyIsImlwYWRkciI6IjE2Ny4yMjAuMjU1LjgiLCJuYW1lIjoiRXJpYyBaaGFuZyAoU2hhbmcgSGFpIFdlaSBDaHVhbmcgUnVhbiBKaWFuKSIsIm9pZCI6IjQ3NjgwMTFhLTY2NjgtNGFlNC1hYmYwLTU3NDM2ZGIyODQ1MSIsIm9ucHJlbV9zaWQiOiJTLTEtNS0yMS0yMTQ2NzczMDg1LTkwMzM2MzI4NS03MTkzNDQ3MDctMTg4MDU0NSIsInB1aWQiOiIxMDAzMDAwMDhDMjJBQkRFIiwic2NwIjoiQ29udGVudC5DcmVhdGUgRGFzaGJvYXJkLlJlYWQuQWxsIERhdGEuQWx0ZXJfQW55IERhdGFzZXQuUmVhZC5BbGwgRGF0YXNldC5SZWFkV3JpdGUuQWxsIEdyb3VwLlJlYWQgR3JvdXAuUmVhZC5BbGwgTWV0YWRhdGEuVmlld19BbnkgUmVwb3J0LlJlYWQuQWxsIFJlcG9ydC5SZWFkV3JpdGUuQWxsIiwic3ViIjoiNDQ2MVF0VDh6MGpTdHMxV29lZmVHRk5RMkhMQ1VKcWF6SDVuOEJLWnRVUSIsInRpZCI6IjcyZjk4OGJmLTg2ZjEtNDFhZi05MWFiLTJkN2NkMDExZGI0NyIsInVuaXF1ZV9uYW1lIjoidi1sdnpoYW5AbWljcm9zb2Z0LmNvbSIsInVwbiI6InYtbHZ6aGFuQG1pY3Jvc29mdC5jb20iLCJ2ZXIiOiIxLjAifQ.L5hpKJgcNR4s24ev51El8zWXpb3GGN0_ElyW7XQwpzOHs_CmwoB9M9nddRaih1ZY61dEWjxP8ZCDdWSnzGfxAyOGovgQ3ktEMa5QRiwdgxA3EczeqiaP5DoHRhXSADH8XioeJUWM1dNpiBJ42-Dc_1s4YmQHB4J1dIupMx_iVxThcOPRM-nnE8ikCpDRGzP2uIOMr-MKfPUwcScDDO8fhKItptvhh2R6xFmfvquKRNjU_g0xKtgCIn1bYzwcREA7vYjFeWlt90OLfa9FquoKiU7CggmmJTCotTMlIHKHxkJh2ofxQxX5PSPI6BwMx6UxozornpJbLvZOYhmm6C6RWg") $headers.Add("Content-Type","application/json") $uri = "https://api.powerbi.com/v1.0/myorg/groups/$groupsPath/datasets/$datasetID/refreshes" try{ Invoke-WebRequest -Uri $uri -Headers $headers -Method POST } catch [Net.WebException] { $ex=$_ if ($ex-ne$null) { $resp=$ex.Exception.Response; $rs=$resp.GetResponseStream(); [System.IO.StreamReader]$sr=New-Object System.IO.StreamReader($rs); [string]$results=$sr.ReadToEnd(); Write-Host $results } }
Hi @nphdiem95
Where did you find examples to do this? Can you provide me the example code?
Thanks in advance
Hi @Juramirez
You can find the code in this guide: http://www.businessintelligenceinfo.com/business-intelligence/self-service-bi/updating-a-powerbi-dat...
Or on github: https://github.com/Azure-Samples/powerbi-powershell/blob/master/manageRefresh.ps1
Regards,
Diem
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
4 | |
3 | |
3 | |
3 | |
3 |