User State Changes

In activeCollab, objects usually have one of the three states:

  1. Active - object is active and relevant,
  2. Archived - we have done working with a particular object and system will try to keep it off sight as much as possible,
  3. Trashed - object has been moved to Trash. Users can restore it from Trash if needed within 30 days from the time when it was moved to Trash.
Some objects get archived automatically, and some need to be explicetly moved to archive by the user. For example, projects, task lists and tasks get archived when you complete them, but users, companies, job types etc don't.

Working with Archive

All objects start as active, and than can be moved to trash or archive. Lets see how this work on an example of a person who temporaly left our company:

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

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
{
    "single": {
        "id": 2,
        "class": "Member",
        "url_path": "\/users\/2",
        "is_archived": false,
        "is_trashed": false,
        "trashed_on": null,
        "trashed_by_id": 0,
        "created_on": 1430164682,
        "created_by_id": 1,
        "updated_on": 1430164682,
        "updated_by_id": 1,
        "language_id": 0,
        "first_name": "Peter",
        "last_name": "Smith",
        "display_name": "Peter Smith",
        "short_display_name": "Peter S.",
        "email": "member@activecollab.com",
        "additional_email_addresses": [],
        "is_pending_activation": false,
        "avatar_url": "http:\/\/feather.dev\/proxy.php?proxy=avatar&module=system&v=current&b=DEV&user_id=2&size=--SIZE--&timestamp=1430164682",
        "custom_permissions": [],
        "company_id": 1,
        "title": null,
        "phone": null,
        "im_type": null,
        "im_handle": null,
        "note": null
    }
}

Peter left to take care of a family matter, so we don't want to remove his account completely. Instead, we'll move it to archive to release the seat for his replacement. This is easily done by sending a PUT request to /move-to-archive path:

Response: HTTP 200, application/json (Hide)
PUT /move-to-archive/user/2

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
{
    "single": {
        "id": 2,
        "class": "Member",
        "url_path": "\/users\/2",
        "is_archived": true,
        "is_trashed": false,
        "trashed_on": null,
        "trashed_by_id": 0,
        "created_on": 1430164682,
        "created_by_id": 1,
        "updated_on": 1430164682,
        "updated_by_id": 1,
        "language_id": 0,
        "first_name": "Peter",
        "last_name": "Smith",
        "display_name": "Peter Smith",
        "short_display_name": "Peter S.",
        "email": "member@activecollab.com",
        "additional_email_addresses": [],
        "is_pending_activation": false,
        "avatar_url": "http:\/\/feather.dev\/proxy.php?proxy=avatar&module=system&v=current&b=DEV&user_id=2&size=--SIZE--&timestamp=1430164682",
        "custom_permissions": [],
        "company_id": 1,
        "title": null,
        "phone": null,
        "im_type": null,
        "im_handle": null,
        "note": null
    }
}

A couple of months later, Peter is back. Lets restore his account from archive so he can continue where he left off by sending PUT request to /restore-from-archive path:

Response: HTTP 200, application/json (Hide)
PUT /restore-from-archive/user/2

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
{
    "single": {
        "id": 2,
        "class": "Member",
        "url_path": "\/users\/2",
        "is_archived": false,
        "is_trashed": false,
        "trashed_on": null,
        "trashed_by_id": 0,
        "created_on": 1430164682,
        "created_by_id": 1,
        "updated_on": 1430164683,
        "updated_by_id": 1,
        "language_id": 0,
        "first_name": "Peter",
        "last_name": "Smith",
        "display_name": "Peter Smith",
        "short_display_name": "Peter S.",
        "email": "member@activecollab.com",
        "additional_email_addresses": [],
        "is_pending_activation": false,
        "avatar_url": "http:\/\/feather.dev\/proxy.php?proxy=avatar&module=system&v=current&b=DEV&user_id=2&size=--SIZE--&timestamp=1430164683",
        "custom_permissions": [],
        "company_id": 1,
        "title": null,
        "phone": null,
        "im_type": null,
        "im_handle": null,
        "note": null
    }
}

Working with Trash

Today we accidentally create an account for someone who should not get invited:

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

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
{
    "single": {
        "id": 3,
        "class": "Member",
        "url_path": "\/users\/3",
        "is_archived": false,
        "is_trashed": false,
        "trashed_on": null,
        "trashed_by_id": 0,
        "created_on": 1430164682,
        "created_by_id": 1,
        "updated_on": 1430164682,
        "updated_by_id": 1,
        "language_id": 0,
        "first_name": "Accidentally-added-user",
        "last_name": null,
        "display_name": "accidentally-added-user",
        "short_display_name": "accidentally-added-user",
        "email": "accidentally-added-user@activecollab.com",
        "additional_email_addresses": [],
        "is_pending_activation": false,
        "avatar_url": "http:\/\/feather.dev\/proxy.php?proxy=avatar&module=system&v=current&b=DEV&user_id=3&size=--SIZE--&timestamp=1430164682",
        "custom_permissions": [],
        "company_id": 1,
        "title": null,
        "phone": null,
        "im_type": null,
        "im_handle": null,
        "note": null
    }
}

To move this account to trash, we need to send a PUT request to /move-to-trash path:

Response: HTTP 200, application/json (Hide)
PUT /move-to-trash/user/3

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
{
    "single": {
        "id": 3,
        "class": "Member",
        "url_path": "\/users\/3",
        "is_archived": false,
        "is_trashed": true,
        "trashed_on": 1430164683,
        "trashed_by_id": 1,
        "created_on": 1430164682,
        "created_by_id": 1,
        "updated_on": 1430164683,
        "updated_by_id": 1,
        "language_id": 0,
        "first_name": "Accidentally-added-user",
        "last_name": null,
        "display_name": "accidentally-added-user",
        "short_display_name": "accidentally-added-user",
        "email": "accidentally-added-user@activecollab.com",
        "additional_email_addresses": [],
        "is_pending_activation": false,
        "avatar_url": "http:\/\/feather.dev\/proxy.php?proxy=avatar&module=system&v=current&b=DEV&user_id=3&size=--SIZE--&timestamp=1430164683",
        "custom_permissions": [],
        "company_id": 1,
        "title": null,
        "phone": null,
        "im_type": null,
        "im_handle": null,
        "note": null
    }
}

If we leave this account in Trash for 30 days, it will get automatically deleted by activeCollab. Still, we can restore it any time in that time frame by sending a PUT request to /restore-from-trash command:

Response: HTTP 200, application/json (Hide)
PUT /restore-from-trash/user/3

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
{
    "single": {
        "id": 3,
        "class": "Member",
        "url_path": "\/users\/3",
        "is_archived": false,
        "is_trashed": false,
        "trashed_on": null,
        "trashed_by_id": 0,
        "created_on": 1430164682,
        "created_by_id": 1,
        "updated_on": 1430164683,
        "updated_by_id": 1,
        "language_id": 0,
        "first_name": "Accidentally-added-user",
        "last_name": null,
        "display_name": "accidentally-added-user",
        "short_display_name": "accidentally-added-user",
        "email": "accidentally-added-user@activecollab.com",
        "additional_email_addresses": [],
        "is_pending_activation": false,
        "avatar_url": "http:\/\/feather.dev\/proxy.php?proxy=avatar&module=system&v=current&b=DEV&user_id=3&size=--SIZE--&timestamp=1430164683",
        "custom_permissions": [],
        "company_id": 1,
        "title": null,
        "phone": null,
        "im_type": null,
        "im_handle": null,
        "note": null
    }
}

Reactivation

There is a special command that will make sure that object is active, regardless of its current state (you don't need to check if the object is trashed, or archived, or archived and than trashed). To fully reactivate an object, send PUT request to /reactivate path:

Response: HTTP 200, application/json (Hide)
PUT /reactivate/user/3

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
{
    "single": {
        "id": 3,
        "class": "Member",
        "url_path": "\/users\/3",
        "is_archived": false,
        "is_trashed": false,
        "trashed_on": null,
        "trashed_by_id": 0,
        "created_on": 1430164682,
        "created_by_id": 1,
        "updated_on": 1430164683,
        "updated_by_id": 1,
        "language_id": 0,
        "first_name": "Accidentally-added-user",
        "last_name": null,
        "display_name": "accidentally-added-user",
        "short_display_name": "accidentally-added-user",
        "email": "accidentally-added-user@activecollab.com",
        "additional_email_addresses": [],
        "is_pending_activation": false,
        "avatar_url": "http:\/\/feather.dev\/proxy.php?proxy=avatar&module=system&v=current&b=DEV&user_id=3&size=--SIZE--&timestamp=1430164683",
        "custom_permissions": [],
        "company_id": 1,
        "title": null,
        "phone": null,
        "im_type": null,
        "im_handle": null,
        "note": null
    }
}