Update Template Schedule with API
I am looking for a way to update the cron schedule for a template via an API call is this possible?
You can update every entity using the same OData API.
Please see the docs https://jsreport.net/learn/api#crud
In this case, the call can look like this
"cron": "5 55 * * * *"
Let me know if you need further help.
Hello, Thanks this worked, however I noticed that the nextRun field isn't updated automatically unless i disable then re enable the schedule.
Is there any other way to do it automatically? Other that setting this field manually as well?
Do you use the latest jsreport 2.8.0?
I see it working there, the
nextRunis being automatically updated when cron is changed.
I remember there were some fixes done recently regarding this.
Hello Im currently using version 2.7.2, how can we update to the latest version without losing the work we have done. Please note that we are using mssql-store to store all the jsreport info in our db. Will the new version have the same DB structure when updated?
There are likely some small changes in the schema.
I would use the following flow.
- backup everything
- create your current db clone
- install jsreport 2.8.0 and run it configured to the db clone
- test the app, it can fail on some schema errors, typically with error "missing column jsreport_TemplateType"
- run alter table jsreport_TemplateType <column> <datatype>, you can get the type from http://localhost:5488/odata/$metadata
- when everything works, you can use the same alters on your current db and update jsreport