Can schedules and event listeners be scripted?

As part of my company’s deployment process for Production sandboxes (Clover Server 3.5.0.57), I would like to automate the following:

[list=]
[*] creation of a schedule for new Jobflows
[*] creation of event listeners for new Jobflows
[/list]

These can both be selectively exported (as XML) and imported via the administrative Clover Server console, but is there any way to script these processes? (The HTTP API doesn’t seem to cover these administrative tasks… Writing SQL scripts for the metadata database is possible…)

Thanks,
-- flag

Hi flag,

Unfortunately we don’t have API for that. Most suitable seems export of configuration (operation export_server_config), doing change in XML, import of configuration (import_server_config). If you prepare template for scheduler/listener then automation may be easy.

I hope this helps.

Seems like a viable approach, especially since our deployment process can easily use the HTTP API (http://server-demo-ec2.cloveretl.com/cl … ver_config) via PowerShell. 8)

One last question then: If I import ‘schedules’ for example, will they completely overwrite all all the schedules on the target server, or will new ones just be added to the existing schedules? (I’ll try it out myself on our dev server when possible.)

This is quite important because our production server will probably have schedules that are NOT on our development server and I do not want to accidentally delete production schedules!

Thanks again,
-- flag

There is parameter “newOnly” on mentioned service doing exactly what you want. Existing schedulers not presented in XML will be left untouched anyway.

Excellent - I did see that parameter but I was concerned about the Hibernate Sequence in the Clover database and the possibility that, if there is an overlap of IDs how the ‘upsert’ process would react to that. Please consider this thread solved.

-- flag

I’m going to try the HTTP API 's import_server_config. Assuming there is a file on the Clover server, c:\temp\listeners.xml, which has my event listeners:

HTTP GET
{my server’s base URL}:8080/clover/simpleHttpApi/import_server_config?newOnly=true&include=eventListeners&verbose=FULL&xmlFile=c%3A%5Ctemp%5Clisteners.xml

The xml file content is from a config export from the Clover Server GUI. I deleted the corresponding listener and executed this HTTP GET import process, but no luck with either Postman or Fiddler (using Basic auth and the Clover administrative user credentials).

The import call gives an HTTP 200 response and sadly isn’t accompanied by any message. I’ve attached the xml file. Can you provide some insight how to get this import to work?

Thanks,
-- flag

Hi Flag,

you should use POST method instead of GET. See the screenshot from Postman below:
postman.png

Hope this helps.

Thanks Jan,

This works perfectly fine as a POST with Postman (can’t believe I missed that :shock: ).

I’ve also managed it in PowerShell for our Windows-based deployment automation, using ‘Invoke-WebRequest’ and constructing the body of the message using a .Net StringBuilder since PowerShell isn’t as straightforward as CURL for this flavor of POST.

(Shameless plug for Fiddler’s ‘compare’ feature, without which I would have spent hours finding out why my PowerShell requests were failing while Postman’s worked just fine!)

Thanks again,
-- flag