Discussions
To list all discussions in a project, send GET request to /projects/:project_id/discussions
path:
Response:
1 2 3 4
{ "discussions": [], "comments": [] }
As we can see, there are no discussions in this projects. To create a new discussions, send POST request to /projects/:project_id/discussions
path:
Payload:
1 2 3
{ "name": "New Discussion" }
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
{ "single": { "id": 1, "class": "Discussion", "url_path": "\/projects\/1\/discussions\/1", "name": "New Discussion", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "", "body_formatted": "", "created_on": 1430164053, "created_by_id": 1, "updated_on": 1430164053, "updated_by_id": 1 }, "subscribers": [ 1 ], "comments": [] }
If we execute /projects/:project_id/discussions
again, we'll see that we have successfully added a discussion:
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
{ "discussions": [ { "id": 1, "class": "Discussion", "url_path": "\/projects\/1\/discussions\/1", "name": "New Discussion", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "", "body_formatted": "", "created_on": 1430164053, "created_by_id": 1, "updated_on": 1430164053, "updated_by_id": 1 } ], "comments": [] }
We can also check out individual discussion details:
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
{ "single": { "id": 1, "class": "Discussion", "url_path": "\/projects\/1\/discussions\/1", "name": "New Discussion", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "", "body_formatted": "", "created_on": 1430164053, "created_by_id": 1, "updated_on": 1430164053, "updated_by_id": 1 }, "subscribers": [ 1 ], "comments": [] }
What is interesting about discussions is that they also list all of the other project elements that are discussed (tasks, files, and notes). Lets check:
This task will not be part of the discussions response because it is not yet discussed:
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
{ "discussions": [ { "id": 1, "class": "Discussion", "url_path": "\/projects\/1\/discussions\/1", "name": "New Discussion", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "", "body_formatted": "", "created_on": 1430164053, "created_by_id": 1, "updated_on": 1430164053, "updated_by_id": 1 } ], "comments": [] }
Payload:
1 2 3
{ "body": "Comment body" }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
{ "single": { "id": 1, "class": "Comment", "url_path": "\/comments\/1", "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "parent_type": "Task", "parent_id": 1, "body": "Comment body", "body_formatted": "Comment body", "body_plain_text": "Comment body", "created_on": 1430164056, "created_by_id": 1, "updated_on": 1430164056, "updated_by_id": 1 } }
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
{ "discussions": [ { "id": 1, "class": "Task", "url_path": "\/projects\/1\/tasks\/1", "name": "New Task", "assignee_id": 0, "delegated_by_id": 0, "completed_on": null, "completed_by_id": null, "is_completed": false, "comments_count": "1", "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": 1430164054, "created_by_id": 1, "updated_on": 1430164056, "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 }, { "id": 1, "class": "Discussion", "url_path": "\/projects\/1\/discussions\/1", "name": "New Discussion", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "", "body_formatted": "", "created_on": 1430164053, "created_by_id": 1, "updated_on": 1430164053, "updated_by_id": 1 } ], "comments": { "Task": { "1": { "id": 1, "parent_type": "Task", "parent_id": 1, "body": "Comment body", "created_on": 1430164056, "created_by_id": 1, "created_by_name": "ilija.studen", "created_by_email": "ilija.studen@activecollab.com", "body_excerpt": "Comment body" } } } }
To update a discussion, we need to send a PUT request to the discussion URL:
Payload:
1 2 3 4
{ "name": "Updated Discussion Name", "body": "<p>We should talk about something<\/p>" }
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
{ "single": { "id": 1, "class": "Discussion", "url_path": "\/projects\/1\/discussions\/1", "name": "Updated Discussion Name", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "<p>We should talk about something<\/p>", "body_formatted": "<p>We should talk about something<\/p>", "created_on": 1430164053, "created_by_id": 1, "updated_on": 1430164056, "updated_by_id": 1 }, "subscribers": [ 1 ], "comments": [] }
To move the disucssion to trash, we need to send DELETE request to the discussion URL:
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
{ "single": { "id": 1, "class": "Discussion", "url_path": "\/projects\/1\/discussions\/1", "name": "Updated Discussion Name", "comments_count": 0, "attachments": [], "is_trashed": true, "trashed_on": 1430164056, "trashed_by_id": 1, "project_id": 1, "is_hidden_from_clients": false, "body": "<p>We should talk about something<\/p>", "body_formatted": "<p>We should talk about something<\/p>", "created_on": 1430164053, "created_by_id": 1, "updated_on": 1430164056, "updated_by_id": 1 }, "subscribers": [ 1 ], "comments": [] }