Subscribers
When we were preparing this article, we have added two members (there is an owner in the database already):
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
[ { "id": 1, "class": "Owner", "url_path": "\/users\/1", "is_archived": false, "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "created_on": 1430164943, "created_by_id": 1, "updated_on": 1430164943, "updated_by_id": 1, "language_id": 0, "first_name": "Ilija.studen", "last_name": null, "display_name": "ilija.studen", "short_display_name": "ilija.studen", "email": "ilija.studen@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=1&size=--SIZE--×tamp=1430164943", "custom_permissions": [], "company_id": 1, "title": null, "phone": null, "im_type": null, "im_handle": null, "note": null }, { "id": 2, "class": "Member", "url_path": "\/users\/2", "is_archived": false, "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "created_on": 1430164945, "created_by_id": 1, "updated_on": 1430164945, "updated_by_id": 1, "language_id": 0, "first_name": "Member1", "last_name": null, "display_name": "member1", "short_display_name": "member1", "email": "member1@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--×tamp=1430164945", "custom_permissions": [], "company_id": 1, "title": null, "phone": null, "im_type": null, "im_handle": null, "note": null }, { "id": 3, "class": "Member", "url_path": "\/users\/3", "is_archived": false, "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "created_on": 1430164945, "created_by_id": 1, "updated_on": 1430164945, "updated_by_id": 1, "language_id": 0, "first_name": "Member2", "last_name": null, "display_name": "member2", "short_display_name": "member2", "email": "member2@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--×tamp=1430164945", "custom_permissions": [], "company_id": 1, "title": null, "phone": null, "im_type": null, "im_handle": null, "note": null } ]
and created a project:
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 32 33 34 35 36 37 38 39 40 41
[ { "id": 1, "class": "Project", "url_path": "\/projects\/1", "name": "Test Project", "completed_on": null, "completed_by_id": null, "is_completed": false, "members": [ 1, 2, 3 ], "category_id": 0, "label_id": 0, "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "created_on": 1430164945, "created_by_id": 1, "updated_on": 1430164945, "updated_by_id": 1, "body": null, "body_formatted": "", "company_id": 1, "leader_id": 1, "currency_id": 2, "template_id": 0, "based_on_type": null, "based_on_id": null, "email": "notifications+m2p-Ryk0hk9@mail.manageprojects.com", "is_tracking_enabled": true, "is_client_reporting_enabled": false, "budget": null, "count_tasks": 0, "count_discussions": 0, "count_files": 0, "count_notes": 0 } ]
To start, we'll create a task and make sure that we subscribe everyone, as well as a couple of anonynous users (people who don't have an account in your activeCollab, but still need to be kept in the loop):
Payload:
1 2 3 4 5 6 7 8 9 10 11 12
{ "name": "Task #1", "assignee_id": 2, "subscribers": [ 3, [ "Someone Anonymous", "anon1@activecollab.com" ], "anon2@activecollab.com" ] }
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
{ "single": { "id": 1, "class": "Task", "url_path": "\/projects\/1\/tasks\/1", "name": "Task #1", "assignee_id": 2, "delegated_by_id": 1, "completed_on": null, "completed_by_id": null, "is_completed": false, "comments_count": 0, "attachments": [], "labels": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "", "body_formatted": "", "created_on": 1430164946, "created_by_id": 1, "updated_on": 1430164946, "updated_by_id": 1, "task_number": 1, "task_list_id": 0, "position": 1, "is_important": false, "due_on": null, "estimate": 0, "job_type_id": 0, "total_subtasks": 0, "completed_subtasks": 0, "open_subtasks": 0 }, "subscribers": [ [ "Someone Anonymous", "anon1@activecollab.com" ], [ "anon2", "anon2@activecollab.com" ], 1, 2, 3 ], "comments": [], "reminders": [], "subtasks": [], "task_list": null, "tracked_time": 0, "tracked_expenses": 0 }
We can also load subscriptions of any object without loading the full object:
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13
[ [ "Someone Anonymous", "anon1@activecollab.com" ], [ "anon2", "anon2@activecollab.com" ], 1, 2, 3 ]
Lets add more subscribers (payload key is ignored, value is all that matters):
Payload:
1 2 3 4 5 6 7
{ "s1": "anon3@activecollab.com", "s2": [ "Another Anonymous", "anon4@activecollab.com" ] }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
[ [ "Someone Anonymous", "anon1@activecollab.com" ], [ "anon2", "anon2@activecollab.com" ], 1, 2, 3, [ "anon3", "anon3@activecollab.com" ], [ "Another Anonymous", "anon4@activecollab.com" ] ]
We don't like how this list turned out. Lets replace the whole set just with task assignee, person who delegated the task and a client who requested the task to be done:
Payload:
1 2 3 4 5 6 7 8
{ "s1": 1, "s2": 2, "s3": [ "Someone Anonymous", "anon1@activecollab.com" ] }
Response:
1 2 3 4 5 6 7 8
[ 1, 2, [ "Someone Anonymous", "anon1@activecollab.com" ] ]
To clear subscribers, we should send DELETE command:
Known users (with user accounts) can also be subscribed and unsubscribed individually:
Response:
1 2 3 4
[ 1, 2 ]