如何使用API更新/编辑刷新计划



我们有100个报告在刷新计划中落后,Microsoft向我们确认了这就是它的工作方式:刷新以FIFO的形式排队,因此服务器上的刷新计划越多,无论计划预期如何,报告都需要越长的时间来进行刷新。

经过讨论,我们决定建立刷新时间表治理,这样用户就不会创建时间表,我们会的。但是,有数百个时间表(每个报告1个(,手动逐个更新这些时间表需要很长时间。

我们如何更新时间表,比如说每天上午10点或下午2点进行刷新?

我能够深入到cacherefreshplan信息,但我不确定如何用新值"更新它"。在招摇上,我看到了PUT,但不确定这是否是正确的方法。。。

$refreshplan = Invoke-RestMethod -UseDefaultCredentials <# -Credential $creds #> -uri $($baseURI + "api/v2.0/PowerBIReports(path='" + "/Prototypes/report 1" + "')/CacheRefreshP
lans")
$refreshplan.value.ScheduleDescription
At 2:00 AM every day, starting 9/5/2019
$refreshplan.value.Schedule.Definition
StartDateTime             EndDate              EndDateSpecified Recurrence
-------------             -------              ---------------- ----------
2019-09-05T02:00:00-04:00 0001-01-01T00:00:00Z            False @{MinuteRecurrence=; DailyRecurrence=; WeeklyRecurrence=; MonthlyRecurrence=; MonthlyDOWRecurrence=}

$refreshplan.value.Schedule.Definition.StartDateTime
2019-09-05T02:00:00-04:00

您需要调用Update-Refresh-SchedulInGroupneneneba API并传递新的计划,例如:

{
"value": {
"days": [
"Sunday",
"Tuesday",
"Friday",
"Saturday"
],
"times": [
"07:00",
"11:30",
"16:00",
"23:30"
],
"localTimeZoneId": "UTC"
}
}

要查找组,您可以使用Get-groups API并使用Get-datasets in group API枚举组中的数据集,当然,您也可以自己准备一个列表。

想明白了!

$refreshplan = Invoke-RestMethod -UseDefaultCredentials -uri $($webPortalURL + "/api/v2.0/PowerBIReports(path='/PBIReport/ConnectionStringIM')/CacheRefreshPlans") 
$body = @{
"@odata.context" = $($webPortalURL)+"/api/v2.0/`$metadata#CacheRefreshPlans/`$entity";
"Id" = $($refreshplan.value[0].Id);
"CatalogItemPath" = $($refreshplan.value[0].CatalogItemPath);
"EventType" = $($refreshplan.value[0].EventType);
"Schedule" = @{
"ScheduleID" = $null;
"Definition"= @{
"StartDateTime" = "2020-03-18T05:00:00+05:30";
"EndDate" = "0001-01-01T00:00:00Z";
"EndDateSpecified" = $false;
"Recurrence" = @{
"DailyRecurrence" = @{
"DaysInterval"=1
}
}
}
};
"ParameterValues" = @();
}
Invoke-RestMethod -UseDefaultCredentials -uri $($webPortalURL + "/api/v2.0/CacheRefreshPlans(e794244c-6743-4100-a9e7-f6eab486fc30)") -Method Put -Body ($body | ConvertTo-Json -Depth 100) -ContentType "application/json"

最新更新