Forum Discussion
Keep getting a 400 Bad Request error when trying to update refresh schedule via API
- 5 years ago
Always test your API calls in the sandbox.
Datasets - Update Refresh Schedule In Group (Power BI Power BI REST APIs) | Microsoft Docs
Refreshes can only be scheduled at :00 and :30 (top and bottom of hour). You can't supply a random minute number.
Hi,
Trying to automate the schedule refresh enable portion once they are in disable state.
Using below code:-
$refreshScheduleState ="true"
$urlRefreshScedule = "https://api.powerbi.com/v1.0/myorg/groups/{groupid}/datasets/{datasetid}/refreshSchedule"
$body = '{ "value": {"enabled": '+$refreshScheduleState+' }}'
Invoke-PowerBIRestMethod -Url $urlRefreshScedule -Body $body -Method PATCH
But getting error while running this code.
Invoke-PowerBIRestMethod : One or more errors occurred.
At line:1 char:2
+ Invoke-PowerBIRestMethod -Url $urlRefreshScedule -Body $body -Method ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Power...werBIRestMethod:I
nvokePowerBIRestMethod) [Invoke-PowerBIRestMethod], AggregateException
+ FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.C
ommands.Profile.InvokePowerBIRestMethod
Kindly suggest
Try:
$refreshScheduleState = '"true"'
Cheers, Mike