4.04.2014

Deleting Old Scheduled Report Ouptuts Using the Jaspersoft REST API

I get this request quite a bit - how do I clean up old artifacts from the Jaspersoft repository? Old artifacts are typically reports that are scheduled and then saved into the repository. I explain this in a short video:



Here are some specifics about the Talend/Jaspersoft ETL job used:
  • tHttpRequest - Does a GET to the URI "http://localhost:8080/jasperserver-pro/rest_v2/resources?recursive=true&type=file&folderUri=/public/ScheduledReports" and writes it to an XML file. API reference- see "Searching the Repository"
  • tFileInputXML - Reads the XML response from file (written by tHttpRequest)
  • tFilterRow - Filters the XML file on the field "creationDate" with the value: TalendDate.parseDate("yyyy-MM-dd", "2014-03-04")
  • tFlowToIterate - takes each request and iterates through them
  • tREST - For each file (URI) we run the DELETE command: "http://localhost:8080/jasperserver-pro/rest_v2/resources" + ((String)globalMap.get("row2.uri")) API reference- see "Deleting Resources"
You can find my example job here - it is for Talend 5.4.1