The REST API provides the following methods for managing archive cleanup and Error Queue defragmentation tasks:

GET /api/archivecleanup/cleanup

URI

GET /api/archivecleanup/cleanup

Description Gets the archive cleanup status and results.

Request Header

Accept: application/json

Accept: application/vnd.orchestral.rhapsody.6_2+json

Request Body

Empty.

Response Status

200 OK - operation successful.

Response Body

The response body has the following structure:

{
    "data":{
        "manualStatus": {
            "status": "NOT_RUNNING",
            "result": "SUCCEEDED",
            "completionTime": "20150806T170751.603+1200",
            "runDuration": "PT0.592S",
            "filesRemoved": 0,
            "filesFailedToRemoved": 0,
            "diskSpaceFreed": 0,
            "diskSpaceFailedToFree": 0,
            "eligibleDefragMessages": 131301
        },
        "automaticStatus": {
            "status": "NOT_RUNNING",
            "result": "SUCCEEDED",
            "completionTime": "20150806T171000.523+1200",
            "runDuration": "PT0.521S",
            "filesRemoved": 0,
            "filesFailedToRemoved": 0,
            "diskSpaceFreed": 0,
            "diskSpaceFailedToFree": 0,
            "eligibleDefragMessages": 131289
        }
    },
    "error": null
}

The units for diskSpaceFreed and diskSpaceFailedToFree are bytes.

Access Rights

'Organize archive cleanup REST API'.

POST /api/archivecleanup/cleanup

URI

POST /api/archivecleanup/cleanup

Description

Starts an archive cleanup.

Request Header

CSRF Protection Enabled

Request Body

Empty.

Response Status

204 OK - operation successful.

Response Body

Empty.

Access Rights

Organize archive cleanup REST API

DELETE /api/archivecleanup/cleanup

URI

DELETE /api/archivecleanup/cleanup

Description

Cancels a running archive cleanup.

Request Header

CSRF Protection Enabled

Request Body

Empty.

Response Status

204 OK - operation successful.

Response Body

Empty.

Access Rights

'Organize archive cleanup REST API'.

GET /api/archivecleanup/cleanup/settings

URI

GET /api/archivecleanup/cleanup/settings

Description Retrieves the archive cleanup settings.
Request Header Accept: application/json
Accept: application/vnd.orchestral.rhapsody.6_2+json 
Accept: application/vnd.orchestral.rhapsody.6_3+json
Request Body Empty.
Response Status 200 OK - operation successful.
Response Body

Returns the settings in JSON format. If a schedule is set then the current schedule type and settings are also returned:

  • archiveDataPeriodUnit can be one of DAY, HOUR.
  • scheduleperiodType can be one of HOURLY, DAILY, WEEKLY, MONTHLY, CRON.
  • scheduleweeklyScheduledayOfWeek can be one of MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY.
  • schedulemonthlySchedulemonthlyMode can be one of FIRST_DAY, LAST_DAY, CHOOSE_DAY.
Examples
With hourly schedule
{
    "data":{
        "archiveDataPeriod": 1,
        "archiveDataPeriodUnit": "HOUR",
        "logsPeriod": 28,
        "cleanupNotificationEvents": false,
        "notificationEventDataPeriod": 90,
        "schedule":{
            "periodType": "HOURLY",
            "hourlySchedule": {
                "hourlyPeriod": 5,
                "hourlyMinuteOfHour": 0
            },
            "dailySchedule": null,
            "weeklySchedule": null,
            "monthlySchedule": null,
            "cronSchedule": null
        },
        "cleanupOldBackups": true,
        "backupCleanupPeriod": 28
    },
    "error": null
}
With daily schedule
{
    "data":{
        "archiveDataPeriod": 1,
        "archiveDataPeriodUnit": "HOUR",
        "logsPeriod": 28,
        "cleanupNotificationEvents": false,
        "notificationEventDataPeriod": 90,
        "schedule":{
            "periodType": "DAILY",
            "hourlySchedule": null,
            "dailySchedule": {
                "hourOfDay": 3,
                "minuteOfHour": 18
            },
            "weeklySchedule": null,
            "monthlySchedule": null,
            "cronSchedule": null
        },
        "cleanupOldBackups": true,
        "backupCleanupPeriod": 28
    },
    "error": null
}
With weekly schedule
{
    "data":{
        "archiveDataPeriod": 1,
        "archiveDataPeriodUnit": "HOUR",
        "logsPeriod": 28,
        "cleanupNotificationEvents": false,
        "notificationEventDataPeriod": 90,
        "schedule":{
            "periodType": "WEEKLY",
            "hourlySchedule": null,
            "dailySchedule": null,
            "weeklySchedule": {
                "hourOfDay": 3,
                "minuteOfHour": 18,
                "dayOfWeek": "WEDNESDAY"
            },
            "monthlySchedule": null,
            "cronSchedule": null
        },
        "cleanupOldBackups": true,
        "backupCleanupPeriod": 28
    },
    "error": null
} 
With monthly schedule
{
    "data":{
       "archiveDataPeriod": 1,
        "archiveDataPeriodUnit": "HOUR",
        "logsPeriod": 28,
        "cleanupNotificationEvents": false,
        "notificationEventDataPeriod": 90,
        "schedule":{
            "periodType": "MONTHLY",
            "hourlySchedule": null,
            "dailySchedule": null,
            "weeklySchedule": null,
            "monthlySchedule": {
                "hourOfDay": 3,
                "minuteOfHour": 18,
                "dayOfMonth": 6,
                "monthlyMode": "CHOOSE_DAY"
            },
            "cronSchedule": null
        },
        "cleanupOldBackups": true,
        "backupCleanupPeriod": 28
    },
    "error": null
}
With cron schedule
 {
    "data":{
        "archiveDataPeriod": 1,
        "archiveDataPeriodUnit": "HOUR",
        "logsPeriod": 28,
        "cleanupNotificationEvents": false,
        "notificationEventDataPeriod": 90,
        "schedule":{
            "periodType": "CRON",
            "hourlySchedule": null,
            "dailySchedule": null,
            "weeklySchedule": null,
            "monthlySchedule": null,
            "cronSchedule": {
                "cronExpression": "0 0 3 6 * ?"
            },
        },
        "cleanupOldBackups": true,
        "backupCleanupPeriod": 28
    },
    "error": null
}
Access Rights 'Organize archive cleanup REST API'.

PUT /api/archivecleanup/cleanup/settings

URI

PUT /api/archivecleanup/cleanup/settings

Description

Allows the user to set the archive cleanup settings.

Request Header

Content-Type: application/json  

Content-Type: application/vnd.orchestral.rhapsody.6_2+json
Content-Type: application/vnd.orchestral.rhapsody.6_3+json

Request Body

Accepts new settings in JSON format. If a schedule is set then the appropriate schedule information is required. Any schedule type that is not set maintains the previous values:

  • archiveDataPeriodUnit can be one of DAY, HOUR.
  • scheduleperiodType can be one of HOURLY, DAILY, WEEKLY, MONTHLY, CRON.
  • scheduleweeklyScheduledayOfWeek can be one of MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY.
  • schedulemonthlySchedulemonthlyMode can be one of FIRST_DAY, LAST_DAY, CHOOSE_DAY.
Examples
Save settings with a hourly schedule
{
    "archiveDataPeriod": 1,
    "archiveDataPeriodUnit": "HOUR",
    "logsPeriod": 28,
    "cleanupNotificationEvents": false,
    "notificationEventDataPeriod": 90,
    "cleanupOldBackups": true,
    "backupCleanupPeriod": 60,
    "schedule":{
        "periodType": "HOURLY",
        "hourlySchedule": {
            "hourlyPeriod": 5,
            "minuteOfHour": 0
        }
    }
}
Save settings with a daily schedule
{
    "archiveDataPeriod": 1,
    "archiveDataPeriodUnit": "HOUR",
    "logsPeriod": 28,
    "cleanupNotificationEvents": false,
    "notificationEventDataPeriod": 90,
    "cleanupOldBackups": true,
    "backupCleanupPeriod": 60,
    "schedule":{
        "periodType": "DAILY",
        "dailySchedule": {
            "hourOfDay": 3,
            "minuteOfHour": 18
        }
    }
}
Save settings with a weekly schedule
{
    "archiveDataPeriod": 1,
    "archiveDataPeriodUnit": "HOUR",
    "logsPeriod": 28,
    "cleanupNotificationEvents": false,
    "notificationEventDataPeriod": 90,
    "cleanupOldBackups": true,
    "backupCleanupPeriod": 60,
    "schedule":{
        "periodType": "WEEKLY",
        "weeklySchedule": {
            "hourOfDay": 3,
            "minuteOfHour": 18,
            "dayOfWeek": "WEDNESDAY"
        }
    }
}
Save settings with a monthly schedule
{
    "archiveDataPeriod": 1,
    "archiveDataPeriodUnit": "HOUR",
    "logsPeriod": 28,
    "cleanupNotificationEvents": false,
    "notificationEventDataPeriod": 90,
    "cleanupOldBackups": true,
    "backupCleanupPeriod": 60,
    "schedule":{
        "periodType": "MONTHLY",
        "monthlySchedule": {
            "hourOfDay": 3,
            "minuteOfHour": 18,
            "dayOfMonth": 6,
            "monthlyMode": "CHOOSE_DAY"
        }
    }
}
Save settings with a cron schedule
{
    "archiveDataPeriod": 1,
    "archiveDataPeriodUnit": "HOUR",
    "logsPeriod": 28,
    "cleanupNotificationEvents": false,
    "notificationEventDataPeriod": 90,
    "cleanupOldBackups": true,
    "backupCleanupPeriod": 60,
    "schedule":{
        "periodType": "CRON",
        "cronSchedule": {
            "cronExpression": "0 0 3 6 * ?"
        }
    }
}
Response Status

204 No Content - operation successful.

Response Body Empty.
Access Rights 'Organize archive cleanup REST API'.

GET /api/archivecleanup/defrag

URI

GET /api/archivecleanup/defrag

Description

Retrieves the defragmentation task status and results.

Request Header

Accept: application/json

Accept: application/vnd.orchestral.rhapsody.6_2+json

Request Body

Empty.

Response Status

200 OK - operation successful.

Response Body

The response body has the following structure:

{
    "data": 
    {
        "currentStatus": "NOT_RUNNING",
        "lastRunResult": "SUCCEEDED",
        "completionTime": "20150806T170917.288+1200",
        "messagesDefragged": 2,
        "messagesFailedDefrag": 0,
        "stoppedPrematurely": true,
        "stoppedPrematurelyReason":"LIMITED_DISK_SPACE"
    },
    "error": null
}
Access Rights

'Organize message defragmentation REST API'.


POST /api/archivecleanup/defrag

URI

POST /api/archivecleanup/defrag

Description

Starts a defragmentation task.

Request Header

CSRF Protection Enabled

Request Body

Empty.

Response Status

204 OK - operation successful.

Response Body

Empty.

Access Rights

'Organize message defragmentation REST API'.

DELETE /api/archivecleanup/defrag

URI

DELETE /api/archivecleanup/defrag

Description

Cancels a running defragmentation task.

Request Header

CSRF Protection Enabled

Request Body

Empty.

Response Status

204 OK - operation successful.

Response Body

Empty.

Access Rights

'Organize message defragmentation REST API'.

GET /api/archivecleanup/defrag/settings

URI

GET /api/archivecleanup/defrag/settings

Description

Retrieves the defragmentation task settings.

Request Header

Accept: application/json

Accept: application/vnd.orchestral.rhapsody.6_2+json

Request Body

Empty.

Response Status

200 OK - operation successful.

Response Body

Returns the settings in JSON format. If a schedule is set then the current schedule type and settings are also returned:

  • launchType can be one of USE_SCHEDULE, AUTOMATICALLY_AFTER_ARCHIVE_CLEANUP, OFF.
  • scheduleperiodType can be one of HOURLY, DAILY, WEEKLY, MONTHLY, CRON.
  • scheduleweeklyScheduledayOfWeek can be one of MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY.
  • schedulemonthlySchedulemonthlyMode can be one of FIRST_DAY, LAST_DAY, CHOOSE_DAY.
Examples
With no schedule
 {
    "data":{
        "defragThreshold": 2,
        "maxMessagesToDefrag": 10000,
        "delayBetweenBatches": 60,
        "messagesPerBatch": 1000,
        "launchType": "AUTOMATICALLY_AFTER_ARCHIVE_CLEANUP",
        "schedule":null
    },
    "error": null
}
With hourly schedule
 {
    "data":{
        "defragThreshold": 2,
        "maxMessagesToDefrag": 10000,
        "delayBetweenBatches": 60,
        "messagesPerBatch": 1000,
        "launchType": "USE_SCHEDULE",
        "schedule":{
            "periodType": "HOURLY",
            "hourlySchedule": {
                "hourlyPeriod": 5,
                "hourlyMinuteOfHour": 0
            },
            "dailySchedule": null,
            "weeklySchedule": null,
            "monthlySchedule": null,
            "cronSchedule": null
        }
    },
    "error": null
}
With daily schedule
 {
    "data":{
        "defragThreshold": 2,
        "maxMessagesToDefrag": 10000,
        "delayBetweenBatches": 60,
        "messagesPerBatch": 1000,
        "launchType": "USE_SCHEDULE",
        "schedule":{
            "periodType": "DAILY",
            "hourlySchedule": null,
            "dailySchedule": {
                "hourOfDay": 3,
                "minuteOfHour": 18
            },
            "weeklySchedule": null,
            "monthlySchedule": null,
            "cronSchedule": null
        }
    },
    "error": null
}
With weekly schedule
 {
    "data":{
        "defragThreshold": 2,
        "maxMessagesToDefrag": 10000,
        "delayBetweenBatches": 60,
        "messagesPerBatch": 1000,
        "launchType": "USE_SCHEDULE",
        "schedule":{
            "periodType": "WEEKLY",
            "hourlySchedule": null,
            "dailySchedule": null,
            "weeklySchedule": {
                "hourOfDay": 3,
                "minuteOfHour": 18,
                "dayOfWeek": "WEDNESDAY"
            },
            "monthlySchedule": null,
            "cronSchedule": null
        }
    },
    "error": null
}
With monthly schedule
 {
    "data":{
        "defragThreshold": 2,
        "maxMessagesToDefrag": 10000,
        "delayBetweenBatches": 60,
        "messagesPerBatch": 1000,
        "launchType": "USE_SCHEDULE",
        "schedule":{
            "periodType": "MONTHLY",
            "hourlySchedule": null,
            "dailySchedule": null,
            "weeklySchedule": null,
            "monthlySchedule": {
                "hourOfDay": 3,
                "minuteOfHour": 18,
                "dayOfMonth": 6,
                "monthlyMode": "CHOOSE_DAY"
            },
            "cronSchedule": null
        }
    },
    "error": null
}
With cron schedule
 {
    "data":{
        "defragThreshold": 2,
        "maxMessagesToDefrag": 10000,
        "delayBetweenBatches": 60,
        "messagesPerBatch": 1000,
        "launchType": "USE_SCHEDULE",
        "schedule":{
            "periodType": "CRON",
            "hourlySchedule": null,
            "dailySchedule": null,
            "weeklySchedule": null,
            "monthlySchedule": null,
            "cronSchedule": {
                "cronExpression": "0 0 3 6 * ?"
            }
        }
    },
    "error": null
}

Access Rights

'Organize message defragmentation REST API'.

PUT /api/archivecleanup/defrag/settings

URI

PUT /api/archivecleanup/defrag/settings

Description

Enables the user to set the defragmentation task settings.

Request Header

Content-Type: application/json

Content-Type: application/vnd.orchestral.rhapsody.6_2+json

Request Body

Accepts the new settings in JSON format. If a schedule is set then the appropriate schedule information is required:

  • launchType can be one of USE_SCHEDULE, AUTOMATICALLY_AFTER_ARCHIVE_CLEANUP, OFF.
  • scheduleperiodType can be one of HOURLY, DAILY, WEEKLY, MONTHLY, CRON.
  • scheduleweeklyScheduledayOfWeek can be one of MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY.
  • schedulemonthlySchedulemonthlyMode can be one of FIRST_DAY, LAST_DAY, CHOOSE_DAY.
Examples
With no schedule
 {
    "defragThreshold": 2,
    "maxMessagesToDefrag": 10000,
    "delayBetweenBatches": 60,
    "messagesPerBatch": 1000,
    "launchType": "AUTOMATICALLY_AFTER_ARCHIVE_CLEANUP",
    "schedule":null
}
Save settings with a hourly schedule
 {
    "defragThreshold": 2,
    "maxMessagesToDefrag": 10000,
    "delayBetweenBatches": 60,
    "messagesPerBatch": 1000,
    "launchType": "USE_SCHEDULE",
    "schedule":{
        "periodType": "HOURLY",
        "hourlySchedule": {
            "hourlyPeriod": 5,
            "hourlyMinuteOfHour": 0
        }
    }
}
Save settings with a daily schedule
 {
    "defragThreshold": 2,
    "maxMessagesToDefrag": 10000,
    "delayBetweenBatches": 60,
    "messagesPerBatch": 1000,
    "launchType": "USE_SCHEDULE",
    "schedule":{
        "periodType": "DAILY",
        "dailySchedule": {
            "hourOfDay": 3,
            "minuteOfHour": 18
        }
    }
}
Save settings with a weekly schedule
 {
    "defragThreshold": 2,
    "maxMessagesToDefrag": 10000,
    "delayBetweenBatches": 60,
    "messagesPerBatch": 1000,
    "launchType": "USE_SCHEDULE",
    "schedule":{
        "periodType": "WEEKLY",
        "weeklySchedule": {
            "hourOfDay": 3,
            "minuteOfHour": 18,
            "dayOfWeek": "WEDNESDAY"
        }
    }
}
Save settings with a monthly schedule
 {
    "defragThreshold": 2,
    "maxMessagesToDefrag": 10000,
    "delayBetweenBatches": 60,
    "messagesPerBatch": 1000,
    "launchType": "USE_SCHEDULE",
    "schedule":{
        "periodType": "MONTHLY",
        "monthlySchedule": {
            "hourOfDay": 3,
            "minuteOfHour": 18,
            "dayOfMonth": 6,
            "monthlyMode": "CHOOSE_DAY"
        }
    }
}
Save settings with a cron schedule
 {
    "defragThreshold": 2,
    "maxMessagesToDefrag": 10000,
    "delayBetweenBatches": 60,
    "messagesPerBatch": 1000,
    "launchType": "USE_SCHEDULE",
    "schedule":{
        "periodType": "CRON",
        "cronSchedule": {
            "cronExpression": "0 0 3 6 * ?"
        }
    }
}
Response Status 204 No Content - operation successful.
Response Body Empty.
Access Rights 'Organize message defragmentation REST API'.