Empty Trash in Waves

While the best way to empty the trash is using command line, there is option to trigger that operation via API as well. When triggered via API, it works in waves, to distribute load (there can be a lot of items in trash). Lets check the content of trash:

Response: HTTP 200, application/json (Hide)
GET /trash

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{
    "User": {
        "2": "member"
    },
    "Comment": {
        "1": "Here's a short list:  * First item * Second Item"
    },
    "Company": {
        "2": "Client Company",
        "3": "Second Client Company"
    },
    "Project": {
        "1": "Test Project"
    },
    "Discussion": {
        "1": "New Discussion"
    },
    "TaskList": {
        "1": "New Task List"
    },
    "Task": {
        "1": "Task #1",
        "2": "Task #2"
    },
    "Subtask": {
        "1": "Subtask that will be automatically trashed"
    },
    "TimeRecord": {
        "1": "Task #2 - Did an awesome job"
    }
}

First wave clears task lists, tasks, discussions, text documents, files and calendars:

Response: HTTP 200, text/html
DELETE /trash?delete_per_iteration=4
Response: HTTP 200, application/json (Hide)
GET /trash

Response:

1
2
3
4
5
6
7
8
9
10
11
12
{
    "User": {
        "2": "member"
    },
    "Company": {
        "2": "Client Company",
        "3": "Second Client Company"
    },
    "Project": {
        "1": "Test Project"
    }
}

Second wave will drop comments, subtasks, time records, expenses and calendar events, but we'll skip that test because we do not have elements to test.

Third wave will drop higher level items, like projects and users:

Response: HTTP 200, text/html
DELETE /trash?delete_per_iteration=2
Response: HTTP 200, application/json (Hide)
GET /trash

Response:

1
2
3
4
5
6
{
    "Company": {
        "2": "Client Company",
        "3": "Second Client Company"
    }
}

Fourth wave will drop companies:

Response: HTTP 200, text/html
DELETE /trash?delete_per_iteration=2

If we check content of trash can now, we'll see that it is empty:

Response: HTTP 200, application/json (Hide)
GET /trash

Response:

1
[]