Forum Discussion
Struggling to create refresh plan with rest API
- 4 years ago
It's probably an issue with the json payload since the Report Portal itself uses the REST api to create schedules.
So what I would suggest is to open the browser developer tools and go to the network tab (I normally use Chrome or the new Edge for this sort of thing). Then create a schedule in the portal that is the same sort of thing that you would want to creat using the API. You should then see the relevant POST calls in the networking tab with real examples of valid json payloads.
You could then delete these example schedules and then re-execute the same requests using Postman.
This is the payload in the report portal for a simple refresh plan:
{
"Owner":null,
"Description":"someDescription",
"CatalogItemPath":"/path/to/pbiReport",
"EventType":"DataModelRefresh",
"Schedule":{
"ScheduleID":null,
"Definition":{
"StartDateTime":"2021-09-22T02:00:00+02:00",
"EndDateSpecified":false,
"EndDate":"1901-02-01T00:00:00+01:00",
"Recurrence":{
"DailyRecurrence":{
"@odata.type":"#Model.DailyRecurrence","DaysInterval":1
}
}
}
},
"ScheduleDescription":"",
"ParameterValues":[]
}
I checked the logs but the error is not really telling me anything (file: RSportal_date.log):
2021-09-22 10:04:53.7689|INFO|113|Received request POST /api/v2.0/CacheRefreshPlans| RequestID = s_d5e5c8ae-e59f-4603-9efb-4f6feb155c79
2021-09-22 10:04:53.7689|ERROR|113|OData exception occurred: System.Web.Http.HttpResponseException: Processing of the HTTP request resulted in an exception. Please see the HTTP response returned by the 'Response' property of this exception for details.
at System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)
at System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger)
at System.Web.Http.ModelBinding.FormatterParameterBinding.<ExecuteBindingAsyncCore>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Web.Http.Controllers.HttpActionBinding.<ExecuteBindingAsyncCore>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext().| RequestID = s_d5e5c8ae-e59f-4603-9efb-4f6feb155c79
ReportingServicesService_*.log does not seem to contain any related error to my post requests.