Jump to content
Changes to the Jaspersoft community edition download ×
  • Schedule a report via REST API after DB query returns successful results


    dnaboka
    • Version: v6.2.1, v6.0.1 Product: Jaspersoft® ETL

    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:

    2017-02-20_1652.png.9b020cdb965830310818a9b5570a1588.png

    Our job consists of 3 components:
    tPostgresInput
    tREST
    tFileOutputJSON
     
    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:downloadscreate_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:
    https://www.base64decode.org/
     

    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:
    http://community.jaspersoft.com/documentation/tibco-jasperreports-server-rest-api-reference/v630/jobs-service#Scheduling_a_Report

    db_action_rest_call.zip


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...