Hitachi Vantara Pentaho Customer Portal

Welcome to Pentaho Support

Create schedule using REST API to remove the generated content files(.pdf,.html...etc) from User folders.

Environment:

Pentaho version 6.1 and above

Objective:

How to remove old reports from users folders which were generated by daily schedules, using Rest API?

Resolution:

Options to do this exist within the Pentaho User Console in Administration> Settings.

However, this can also be achieved using the API  /pentaho/api/scheduler/job

Steps to use this the API:

1. Need to use the API http://localhost:8080/pentaho/api/scheduler/job

2. When using this, we must pass the body either in XML or Json format.  The following example uses the Json format:


{
"jobName": "GeneratedContentCleaner",
"overwriteFile": "false",
"simpleJobTrigger": {
"uiPassParam": "MINUTES",
"repeatInterval": 120,
"repeatCount": -1,
"startTime": "2019-03-12T11:59:00.000+05:30",
"endTime": null
},
"inputFile": "GeneratedContentCleaner",
"outputFile": "",
"timeZone": "Asia/Calcutta",
"jobParameters": [
{
"name": "ActionAdapterQuartzJob-ActionClass",
"type": "string",
"stringValue": [
"org.pentaho.platform.admin.GeneratedContentCleaner"
]
},
{
"name": "age",
"type": "string",
"stringValue": [
"15552000"
]
}
],
"actionClass": "org.pentaho.platform.admin.GeneratedContentCleaner"
}

 

Capture.PNG

Important example parameters from the above code:

Eg:

startTime "2019-03-12T11:59:00.000+05:30": Date and time when you would like to fire this schedule.
stringValue  "15552000": delete the generated files older than 180 days, in seconds (180 days=60*60*24)

3. Next using Postman (or any other preferred tool) to send the below API in POST:

http://localhost:8080/pentaho/api/scheduler/job

4. After the API is executed via Postman, then when refreshed the Pentaho User Console Administration> Settings screen is then updated with the schedule generated by the API:

Capture1.PNG

Important Note:

Attached is a video showing how this can be done.

 


Internal Notes: (Non Customer View-able - Non Confidential)

Example: This issue is logged under Ticket 88527
Have more questions? Submit a request

Comments