Schedule a report via REST API after DB query returns successful results

This example will demo how to use REST API with ETL job. We will schedule a report after DB query returns successful results. REST API call results will be logged in JSON file:

Our job consists of 3 components:
For this demo, tPostgresInput will simply query all the records from Foodmart."Account" table and tFileOutputJSON will store REST API call output in the file on local file-system (e.g. D:\downloads\create_job_schedule.json)
Let's have a closer look at the tREST component. We are doing a PUT request for "http://localhost:8080/jasperserver-pro/rest_v2/jobs/". There are 2 headers we need to set:
1. "Content-Type" = "application/job+json"
2. "Authorization" = "Basic c3VwZXJ1c2VyOnN1cGVydXNlcg=="
String value consists of two parts, "Basic " + Base64 encoded value "username:password". In this case, superuser:superuser is used. You can easily encode your custom credentials here:

Please note, every special character in HTTP Body has to be escaped (refer to tPostgresInput query for example). You can find more information about body request in Web Services guide: