Templates
Personas in this Story: Default, Member1, Member2, Client.
To get started, we'll check access permissions. Only members with permissions to create new projects can access and manage project templates:
To create a template, we can send POST request to /project-templates
resource:
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": "ProjectTemplate", "url_path": "\/project-templates\/1", "name": "", "members": [], "created_on": 1430164517, "created_by_id": 1, "updated_on": 1430164517, "is_draft": true, "is_scheduled": false, "count_task_lists": 0, "count_tasks": 0, "count_subtasks": 0, "count_discussions": 0, "count_files": 0, "count_notes": 0 } }
Notice that there is no required fields in the previous request. That is because templates without a name are considered to be drafts. If we set a name, this template will no longer be draft:
Payload:
1 2 3
{ "name": "Design Project" }
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": "ProjectTemplate", "url_path": "\/project-templates\/1", "name": "Design Project", "members": [], "created_on": 1430164517, "created_by_id": 1, "updated_on": 1430164517, "is_draft": false, "is_scheduled": false, "count_task_lists": 0, "count_tasks": 0, "count_subtasks": 0, "count_discussions": 0, "count_files": 0, "count_notes": 0 } }
Now, lets add a couple of elements to the template:
Files:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
[ [ "ac.png", "image\/png" ], [ "profile.png", "image\/png" ], [ "sketch.png", "image\/png" ] ]
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
[ { "code": "9xWOEe5litQO9KMUtdXGDdW3FMr4i02GUEaZyl8R", "name": "ac.png", "mime_type": "image\/png", "size": 1927, "thumbnail_url": "http:\/\/feather.dev\/proxy.php?proxy=forward_thumbnail&module=system&v=current&b=DEV&context=upload&name=2015-04%2FgWTlLa8RrK2eQgtqRdzFGO59XUyuEHAqpzB2zyHR&original_file_name=ac.png&width=--WIDTH--&height=--HEIGHT--&ver=1927&scale=--SCALE--" }, { "code": "GoVgSImWMjP9TBpDc7yLslUtAfTyNJ52uaI3muDw", "name": "profile.png", "mime_type": "image\/png", "size": 68914, "thumbnail_url": "http:\/\/feather.dev\/proxy.php?proxy=forward_thumbnail&module=system&v=current&b=DEV&context=upload&name=2015-04%2F3LPBmyUlBHS6LDXfee9ncYUXsUMQ7IxXjbovz0H2&original_file_name=profile.png&width=--WIDTH--&height=--HEIGHT--&ver=68914&scale=--SCALE--" }, { "code": "IHnENRGBKkYwPGjTeihhFZslJcBYyl77SiAu18Vz", "name": "sketch.png", "mime_type": "image\/png", "size": 616656, "thumbnail_url": "http:\/\/feather.dev\/proxy.php?proxy=forward_thumbnail&module=system&v=current&b=DEV&context=upload&name=2015-04%2FtiucJKFMF5mXe8fEbZ4OxXFSXdJycwSkQUUppvUi&original_file_name=sketch.png&width=--WIDTH--&height=--HEIGHT--&ver=616656&scale=--SCALE--" } ]
Payload:
1 2 3 4
{ "type": "ProjectTemplateTaskList", "name": "Analyze" }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
{ "single": { "id": 1, "class": "ProjectTemplateTaskList", "url_path": "\/project-templates\/1\/elements\/1", "name": "Analyze", "attachments": [], "body": "", "body_formatted": "", "created_on": 1430164517, "updated_on": 1430164517, "template_id": 1, "position": 0, "start_on": 0, "due_on": 0 } }
Payload:
1 2 3 4 5 6 7
{ "type": "ProjectTemplateTaskList", "name": "Design", "start_on": 2, "due_on": 5, "position": 1 }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
{ "single": { "id": 2, "class": "ProjectTemplateTaskList", "url_path": "\/project-templates\/1\/elements\/2", "name": "Design", "attachments": [], "body": "", "body_formatted": "", "created_on": 1430164518, "updated_on": 1430164518, "template_id": 1, "position": 1, "start_on": 2, "due_on": 5 } }
First task template has a couple of interesting properties:
- It references a task list from the template, so it should be properly connection with a project task list,
- Assignee ID is set, but we don't have it set as template user. This user should be auto-added to the project nevertheless,
- It has three labels,
- It has attachments.
Payload:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
{ "type": "ProjectTemplateTask", "name": "Analyze task", "labels": [ "NEW", "develop" ], "task_list_id": 1, "assignee_id": 3, "due_on": 2, "attach_uploaded_files": [ "9xWOEe5litQO9KMUtdXGDdW3FMr4i02GUEaZyl8R", "GoVgSImWMjP9TBpDc7yLslUtAfTyNJ52uaI3muDw" ], "position": 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
{ "single": { "id": 3, "class": "ProjectTemplateTask", "url_path": "\/project-templates\/1\/elements\/3", "name": "Analyze task", "labels": [ { "id": 16, "name": "develop", "color": null, "is_default": false, "is_global": false, "position": "12" }, { "id": 5, "name": "NEW", "color": "#00B25C", "is_default": false, "is_global": true, "position": "1" } ], "attachments": [ { "id": 1, "name": "ac.png", "mime_type": "image\/png", "size": 1927, "disposition": "attachment", "thumbnail_url": "http:\/\/feather.dev\/proxy.php?proxy=forward_thumbnail&module=system&v=current&b=DEV&context=upload&name=2015-04%2FgWTlLa8RrK2eQgtqRdzFGO59XUyuEHAqpzB2zyHR&original_file_name=ac.png&width=--WIDTH--&height=--HEIGHT--&ver=1927&scale=--SCALE--" }, { "id": 2, "name": "profile.png", "mime_type": "image\/png", "size": 68914, "disposition": "attachment", "thumbnail_url": "http:\/\/feather.dev\/proxy.php?proxy=forward_thumbnail&module=system&v=current&b=DEV&context=upload&name=2015-04%2F3LPBmyUlBHS6LDXfee9ncYUXsUMQ7IxXjbovz0H2&original_file_name=profile.png&width=--WIDTH--&height=--HEIGHT--&ver=68914&scale=--SCALE--" } ], "body": "", "body_formatted": "", "created_on": 1430164518, "updated_on": 1430164518, "template_id": 1, "position": 1, "task_list_id": 1, "assignee_id": 3, "job_type_id": 0, "estimate": 0, "due_on": 2, "is_important": false, "is_hidden_from_clients": false, "label_id": 0 } }
Second task is associated with the second task list and has no labels:
Payload:
1 2 3 4 5 6 7
{ "type": "ProjectTemplateTask", "name": "Design task", "task_list_id": 2, "due_on": 5, "position": 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
{ "single": { "id": 4, "class": "ProjectTemplateTask", "url_path": "\/project-templates\/1\/elements\/4", "name": "Design task", "labels": [], "attachments": [], "body": "", "body_formatted": "", "created_on": 1430164518, "updated_on": 1430164518, "template_id": 1, "position": 2, "task_list_id": 2, "assignee_id": 0, "job_type_id": 0, "estimate": 0, "due_on": 5, "is_important": false, "is_hidden_from_clients": false, "label_id": 0 } }
Payload:
1 2 3 4 5 6
{ "type": "ProjectTemplateSubtask", "body": "First subtask on Design task", "task_id": 4, "position": 1 }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
{ "single": { "id": 5, "class": "ProjectTemplateSubtask", "url_path": "\/project-templates\/1\/elements\/5", "name": "First subtask on Design task", "attachments": [], "body": "First subtask on Design task", "body_formatted": "First subtask on Design task", "created_on": 1430164518, "updated_on": 1430164518, "template_id": 1, "position": 1, "task_id": 4, "assignee_id": 0 } }
Payload:
1 2 3 4 5 6
{ "type": "ProjectTemplateSubtask", "body": "Second subtask on Design task", "task_id": 4, "position": 2 }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
{ "single": { "id": 6, "class": "ProjectTemplateSubtask", "url_path": "\/project-templates\/1\/elements\/6", "name": "Second subtask on Design task", "attachments": [], "body": "Second subtask on Design task", "body_formatted": "Second subtask on Design task", "created_on": 1430164518, "updated_on": 1430164518, "template_id": 1, "position": 2, "task_id": 4, "assignee_id": 0 } }
Payload:
1 2 3 4 5
{ "type": "ProjectTemplateDiscussion", "name": "Lets talk", "body": "About something" }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
{ "single": { "id": 7, "class": "ProjectTemplateDiscussion", "url_path": "\/project-templates\/1\/elements\/7", "name": "Lets talk", "attachments": [], "body": "About something", "body_formatted": "About something", "created_on": 1430164519, "updated_on": 1430164519, "template_id": 1, "position": 0, "is_hidden_from_clients": false } }
Payload:
1 2 3 4 5
{ "type": "ProjectTemplateDiscussion", "name": "Lets talk hm", "body": "About something else" }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
{ "single": { "id": 8, "class": "ProjectTemplateDiscussion", "url_path": "\/project-templates\/1\/elements\/8", "name": "Lets talk hm", "attachments": [], "body": "About something else", "body_formatted": "About something else", "created_on": 1430164519, "updated_on": 1430164519, "template_id": 1, "position": 0, "is_hidden_from_clients": false } }
Payload:
1 2 3 4 5
{ "type": "ProjectTemplateNote", "name": "Main note", "body": "Main note body" }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
{ "single": { "id": 9, "class": "ProjectTemplateNote", "url_path": "\/project-templates\/1\/elements\/9", "name": "Main note", "attachments": [], "body": "Main note body", "body_formatted": "Main note body", "body_plain_text": "Main note body", "created_on": 1430164519, "updated_on": 1430164519, "template_id": 1, "position": 0, "note_id": 0, "is_hidden_from_clients": false } }
Payload:
1 2 3 4 5 6
{ "type": "ProjectTemplateNote", "name": "Sub-note", "body": "Sub-note body", "note_id": 9 }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
{ "single": { "id": 10, "class": "ProjectTemplateNote", "url_path": "\/project-templates\/1\/elements\/10", "name": "Sub-note", "attachments": [], "body": "Sub-note body", "body_formatted": "Sub-note body", "body_plain_text": "Sub-note body", "created_on": 1430164519, "updated_on": 1430164519, "template_id": 1, "position": 0, "note_id": 9, "is_hidden_from_clients": false } }
Payload:
1 2 3 4
{ "type": "ProjectTemplateFile", "uploaded_file_code": "IHnENRGBKkYwPGjTeihhFZslJcBYyl77SiAu18Vz" }
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
{ "single": { "id": 11, "class": "ProjectTemplateFile", "url_path": "\/project-templates\/1\/elements\/11", "name": "sketch.png", "mime_type": "image\/png", "size": 616656, "md5": "", "download_url": "http:\/\/feather.dev\/project-templates\/1\/elements\/download?project_template_element_id=11", "thumbnail_url": "http:\/\/feather.dev\/proxy.php?proxy=forward_thumbnail&module=system&v=current&b=DEV&context=upload&name=2015-04%2FtiucJKFMF5mXe8fEbZ4OxXFSXdJycwSkQUUppvUi&original_file_name=sketch.png&width=--WIDTH--&height=--HEIGHT--&ver=616656&scale=--SCALE--", "file_meta": { "kind": "image", "dimensions": { "width": 1800, "height": 400 } }, "created_on": 1430164519, "updated_on": 1430164519, "template_id": 1, "position": 0, "location": "2015-04\/tiucJKFMF5mXe8fEbZ4OxXFSXdJycwSkQUUppvUi", "is_hidden_from_clients": false } }
For the purpose of this test, we'll create one more template with one extra element, to confirm that per-template filtering and reordering works properly:
Payload:
1 2 3
{ "name": "Second Template" }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
{ "single": { "id": 2, "class": "ProjectTemplate", "url_path": "\/project-templates\/2", "name": "Second Template", "members": [], "created_on": 1430164519, "created_by_id": 1, "updated_on": 1430164519, "is_draft": false, "is_scheduled": false, "count_task_lists": 0, "count_tasks": 0, "count_subtasks": 0, "count_discussions": 0, "count_files": 0, "count_notes": 0 } }
Payload:
1 2 3 4 5 6
{ "type": "ProjectTemplateDiscussion", "name": "Second template discussion", "body": "Just for the test", "position": 8 }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
{ "single": { "id": 12, "class": "ProjectTemplateDiscussion", "url_path": "\/project-templates\/2\/elements\/12", "name": "Second template discussion", "attachments": [], "body": "Just for the test", "body_formatted": "Just for the test", "created_on": 1430164520, "updated_on": 1430164520, "template_id": 2, "position": 8, "is_hidden_from_clients": false } }
Order of discussions is not correct. Lets fix that:
Payload:
1 2 3 4 5
[ 8, 7, 12 ]
Response:
1 2 3 4 5
[ 8, 7, 12 ]
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
{ "single": { "id": 7, "class": "ProjectTemplateDiscussion", "url_path": "\/project-templates\/1\/elements\/7", "name": "Lets talk", "attachments": [], "body": "About something", "body_formatted": "About something", "created_on": 1430164519, "updated_on": 1430164520, "template_id": 1, "position": 2, "is_hidden_from_clients": false } }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
{ "single": { "id": 8, "class": "ProjectTemplateDiscussion", "url_path": "\/project-templates\/1\/elements\/8", "name": "Lets talk hm", "attachments": [], "body": "About something else", "body_formatted": "About something else", "created_on": 1430164519, "updated_on": 1430164520, "template_id": 1, "position": 1, "is_hidden_from_clients": false } }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
{ "single": { "id": 12, "class": "ProjectTemplateDiscussion", "url_path": "\/project-templates\/2\/elements\/12", "name": "Second template discussion", "attachments": [], "body": "Just for the test", "body_formatted": "Just for the test", "created_on": 1430164520, "updated_on": 1430164520, "template_id": 2, "position": 8, "is_hidden_from_clients": false } }
Note: Supported element types are ProjectTemplateTaskList
, ProjectTemplateTask
, ProjectTemplateSubtask
, ProjectTemplateDiscussion
and ProjectTemplateNote
. If we try to create an element that is not supported, system will thrown an error:
Payload:
1 2 3 4
{ "type": "ProjectTemplateSuperUser", "user_id": 1 }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
{ "type": "InvalidParamError", "message": "Value of \"type\" field is not a valid project template element class", "file": "\/var\/www\/activecollab.back\/activecollab\/current\/modules\/system\/models\/project_template_elements\/ProjectTemplateElements.class.php", "line": 150, "trace": "#0 \/var\/www\/activecollab.back\/activecollab\/current\/modules\/system\/controllers\/ProjectTemplateElementsController.class.php(74): ProjectTemplateElements::create(Array)\n#1 \/var\/www\/angie.back\/src\/Angie\/Controller.php(42): ProjectTemplateElementsController->add(Object(Owner))\n#2 \/var\/www\/angie.back\/classes\/application\/AngieApplicationAdapter.class.php(243): Angie\\Controller->executeAction('add')\n#3 \/var\/www\/angie.back\/classes\/application\/AngieApplication.class.php(839): AngieApplicationAdapter->handleHttpRequest('project-templat...', '')\n#4 \/var\/www\/activecollab.back\/instance\/public\/api.php(19): AngieApplication::handleHttpRequest()\n#5 {main}", "previous": null, "var_name": "attributes[type]", "var_value": { "type": "ProjectTemplateSuperUser", "user_id": 1, "template_id": 1 } }
Lets see if elements are properly set. Notice that elements are grouped by type and then ordered by position value (where applicable):
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 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
[ { "id": 8, "class": "ProjectTemplateDiscussion", "url_path": "\/project-templates\/1\/elements\/8", "name": "Lets talk hm", "attachments": [], "body": "About something else", "body_formatted": "About something else", "created_on": 1430164519, "updated_on": 1430164520, "template_id": 1, "position": 1, "is_hidden_from_clients": false }, { "id": 7, "class": "ProjectTemplateDiscussion", "url_path": "\/project-templates\/1\/elements\/7", "name": "Lets talk", "attachments": [], "body": "About something", "body_formatted": "About something", "created_on": 1430164519, "updated_on": 1430164520, "template_id": 1, "position": 2, "is_hidden_from_clients": false }, { "id": 11, "class": "ProjectTemplateFile", "url_path": "\/project-templates\/1\/elements\/11", "name": "sketch.png", "mime_type": "image\/png", "size": 616656, "md5": "", "download_url": "http:\/\/feather.dev\/project-templates\/1\/elements\/download?project_template_element_id=11", "thumbnail_url": "http:\/\/feather.dev\/proxy.php?proxy=forward_thumbnail&module=system&v=current&b=DEV&context=upload&name=2015-04%2FtiucJKFMF5mXe8fEbZ4OxXFSXdJycwSkQUUppvUi&original_file_name=sketch.png&width=--WIDTH--&height=--HEIGHT--&ver=616656&scale=--SCALE--", "file_meta": { "kind": "image", "dimensions": { "width": 1800, "height": 400 } }, "created_on": 1430164519, "updated_on": 1430164519, "template_id": 1, "position": 0, "location": "2015-04\/tiucJKFMF5mXe8fEbZ4OxXFSXdJycwSkQUUppvUi", "is_hidden_from_clients": false }, { "id": 9, "class": "ProjectTemplateNote", "url_path": "\/project-templates\/1\/elements\/9", "name": "Main note", "attachments": [], "body": "Main note body", "body_formatted": "Main note body", "body_plain_text": "Main note body", "created_on": 1430164519, "updated_on": 1430164519, "template_id": 1, "position": 0, "note_id": 0, "is_hidden_from_clients": false }, { "id": 10, "class": "ProjectTemplateNote", "url_path": "\/project-templates\/1\/elements\/10", "name": "Sub-note", "attachments": [], "body": "Sub-note body", "body_formatted": "Sub-note body", "body_plain_text": "Sub-note body", "created_on": 1430164519, "updated_on": 1430164519, "template_id": 1, "position": 0, "note_id": 9, "is_hidden_from_clients": false }, { "id": 5, "class": "ProjectTemplateSubtask", "url_path": "\/project-templates\/1\/elements\/5", "name": "First subtask on Design task", "attachments": [], "body": "First subtask on Design task", "body_formatted": "First subtask on Design task", "created_on": 1430164518, "updated_on": 1430164518, "template_id": 1, "position": 1, "task_id": 4, "assignee_id": 0 }, { "id": 6, "class": "ProjectTemplateSubtask", "url_path": "\/project-templates\/1\/elements\/6", "name": "Second subtask on Design task", "attachments": [], "body": "Second subtask on Design task", "body_formatted": "Second subtask on Design task", "created_on": 1430164518, "updated_on": 1430164518, "template_id": 1, "position": 2, "task_id": 4, "assignee_id": 0 }, { "id": 3, "class": "ProjectTemplateTask", "url_path": "\/project-templates\/1\/elements\/3", "name": "Analyze task", "labels": [ { "id": 16, "name": "develop", "color": null, "is_default": false, "is_global": false, "position": "12" }, { "id": 5, "name": "NEW", "color": "#00B25C", "is_default": false, "is_global": true, "position": "1" } ], "attachments": [ { "id": 1, "name": "ac.png", "mime_type": "image\/png", "size": 1927, "disposition": "attachment", "thumbnail_url": "http:\/\/feather.dev\/proxy.php?proxy=forward_thumbnail&module=system&v=current&b=DEV&context=upload&name=2015-04%2FgWTlLa8RrK2eQgtqRdzFGO59XUyuEHAqpzB2zyHR&original_file_name=ac.png&width=--WIDTH--&height=--HEIGHT--&ver=1927&scale=--SCALE--" }, { "id": 2, "name": "profile.png", "mime_type": "image\/png", "size": 68914, "disposition": "attachment", "thumbnail_url": "http:\/\/feather.dev\/proxy.php?proxy=forward_thumbnail&module=system&v=current&b=DEV&context=upload&name=2015-04%2F3LPBmyUlBHS6LDXfee9ncYUXsUMQ7IxXjbovz0H2&original_file_name=profile.png&width=--WIDTH--&height=--HEIGHT--&ver=68914&scale=--SCALE--" } ], "body": "", "body_formatted": "", "created_on": 1430164518, "updated_on": 1430164518, "template_id": 1, "position": 1, "task_list_id": 1, "assignee_id": 3, "job_type_id": 0, "estimate": 0, "due_on": 2, "is_important": false, "is_hidden_from_clients": false, "label_id": 0 }, { "id": 4, "class": "ProjectTemplateTask", "url_path": "\/project-templates\/1\/elements\/4", "name": "Design task", "labels": [], "attachments": [], "body": "", "body_formatted": "", "created_on": 1430164518, "updated_on": 1430164518, "template_id": 1, "position": 2, "task_list_id": 2, "assignee_id": 0, "job_type_id": 0, "estimate": 0, "due_on": 5, "is_important": false, "is_hidden_from_clients": false, "label_id": 0 }, { "id": 1, "class": "ProjectTemplateTaskList", "url_path": "\/project-templates\/1\/elements\/1", "name": "Analyze", "attachments": [], "body": "", "body_formatted": "", "created_on": 1430164517, "updated_on": 1430164517, "template_id": 1, "position": 0, "start_on": 0, "due_on": 0 }, { "id": 2, "class": "ProjectTemplateTaskList", "url_path": "\/project-templates\/1\/elements\/2", "name": "Design", "attachments": [], "body": "", "body_formatted": "", "created_on": 1430164518, "updated_on": 1430164518, "template_id": 1, "position": 1, "start_on": 2, "due_on": 5 } ]
We'll create a project that starts on 2014-10-06
, to make all variables known. Before we do that, lets make things a bit more interesting and make a second day of the project a day off, so we can confirm that it gets properly skipped:
Payload:
1 2 3 4 5
{ "name": "My 1st", "start_date": "2014-10-07", "end_date": "2014-10-07" }
Response:
1 2 3 4 5 6 7 8 9 10 11 12
{ "single": { "id": 1, "class": "DayOff", "url_path": "\/day-offs\/1", "name": "My 1st", "start_date": 1412640000, "end_date": 1412640000, "is_multi_day": false, "repeat_yearly": false } }
Now, lets create a project that is based on a template:
Payload:
1 2 3 4 5 6
{ "name": "Project from Template", "leader_id": 1, "template_id": 1, "template_date_reference": "2014-10-06" }
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 90 91 92 93 94
{ "single": { "id": 1, "class": "Project", "url_path": "\/projects\/1", "name": "Project from Template", "completed_on": null, "completed_by_id": null, "is_completed": false, "members": [ 1, 3 ], "category_id": 0, "label_id": 0, "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "updated_by_id": 1, "body": null, "body_formatted": "", "company_id": 1, "leader_id": 1, "currency_id": 2, "template_id": 1, "based_on_type": null, "based_on_id": null, "email": "notifications+m2p-GdtjZ0H@mail.manageprojects.com", "is_tracking_enabled": true, "is_client_reporting_enabled": false, "budget": null, "count_tasks": 2, "count_discussions": 2, "count_files": 1, "count_notes": 2 }, "category": null, "hourly_rates": { "1": 100 }, "label_ids": [ 5, 16 ], "task_lists": [ { "id": 1, "class": "TaskList", "url_path": "\/projects\/1\/task-lists\/1", "name": "Analyze", "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "completed_on": null, "completed_by_id": null, "is_completed": false, "project_id": 1, "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "updated_by_id": 1, "start_on": null, "due_on": null, "position": 1, "open_tasks": 1, "completed_tasks": 0 }, { "id": 2, "class": "TaskList", "url_path": "\/projects\/1\/task-lists\/2", "name": "Design", "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "completed_on": null, "completed_by_id": null, "is_completed": false, "project_id": 1, "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "updated_by_id": 1, "start_on": 1412726400, "due_on": 1413158400, "position": 1, "open_tasks": 1, "completed_tasks": 0 } ] }
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
{ "single": { "id": 1, "class": "TaskList", "url_path": "\/projects\/1\/task-lists\/1", "name": "Analyze", "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "completed_on": null, "completed_by_id": null, "is_completed": false, "project_id": 1, "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "updated_by_id": 1, "start_on": null, "due_on": null, "position": 1, "open_tasks": 1, "completed_tasks": 0 } }
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
{ "single": { "id": 2, "class": "TaskList", "url_path": "\/projects\/1\/task-lists\/2", "name": "Design", "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "completed_on": null, "completed_by_id": null, "is_completed": false, "project_id": 1, "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "updated_by_id": 1, "start_on": 1412726400, "due_on": 1413158400, "position": 1, "open_tasks": 1, "completed_tasks": 0 } }
First task should be properly connected with the first task list, properly assigned to one of the members and fall on Oct 8th (because 7th was set as a day off):
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 90 91 92 93 94 95 96 97 98 99 100 101 102
{ "single": { "id": 1, "class": "Task", "url_path": "\/projects\/1\/tasks\/1", "name": "Analyze task", "assignee_id": 3, "delegated_by_id": 1, "completed_on": null, "completed_by_id": null, "is_completed": false, "comments_count": 0, "attachments": [ { "id": 3, "name": "ac.png", "mime_type": "image\/png", "size": 1927, "disposition": "attachment", "thumbnail_url": "http:\/\/feather.dev\/proxy.php?proxy=forward_thumbnail&module=system&v=current&b=DEV&context=upload&name=2015-04%2F9tobXuF0ikhzmwxwGWH3BbOQEluTPy0MRnNEIiCQ&original_file_name=ac.png&width=--WIDTH--&height=--HEIGHT--&ver=1927&scale=--SCALE--" }, { "id": 4, "name": "profile.png", "mime_type": "image\/png", "size": 68914, "disposition": "attachment", "thumbnail_url": "http:\/\/feather.dev\/proxy.php?proxy=forward_thumbnail&module=system&v=current&b=DEV&context=upload&name=2015-04%2FtKeG8C3CnzuPA0u5kPNZcMBUZdoxmQcGphclK6OY&original_file_name=profile.png&width=--WIDTH--&height=--HEIGHT--&ver=68914&scale=--SCALE--" } ], "labels": [ { "id": 16, "name": "develop", "color": null, "is_default": false, "is_global": false, "position": "12" }, { "id": 5, "name": "NEW", "color": "#00B25C", "is_default": false, "is_global": true, "position": "1" } ], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "", "body_formatted": "", "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "updated_by_id": 1, "task_number": 1, "task_list_id": 1, "position": 1, "is_important": false, "due_on": 1412726400, "estimate": 0, "job_type_id": 0, "total_subtasks": 0, "completed_subtasks": 0, "open_subtasks": 0 }, "subscribers": [ 1, 3 ], "comments": [], "reminders": [], "subtasks": [], "task_list": { "id": 1, "class": "TaskList", "url_path": "\/projects\/1\/task-lists\/1", "name": "Analyze", "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "completed_on": null, "completed_by_id": null, "is_completed": false, "project_id": 1, "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "updated_by_id": 1, "start_on": null, "due_on": null, "position": 1, "open_tasks": 1, "completed_tasks": 0 }, "tracked_time": 0, "tracked_expenses": 0 }
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 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
{ "single": { "id": 2, "class": "Task", "url_path": "\/projects\/1\/tasks\/2", "name": "Design task", "assignee_id": 0, "delegated_by_id": 0, "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": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "updated_by_id": 1, "task_number": 2, "task_list_id": 2, "position": 2, "is_important": false, "due_on": 1413158400, "estimate": 0, "job_type_id": 0, "total_subtasks": 2, "open_subtasks": 2, "completed_subtasks": 0 }, "subscribers": [ 1 ], "comments": [], "reminders": [], "subtasks": [ { "id": 1, "class": "Subtask", "url_path": "\/projects\/1\/tasks\/2\/subtasks\/1", "assignee_id": 0, "delegated_by_id": 0, "completed_on": null, "completed_by_id": null, "is_completed": false, "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "name": "First subtask on Design task", "task_id": 2, "project_id": 1, "due_on": null }, { "id": 2, "class": "Subtask", "url_path": "\/projects\/1\/tasks\/2\/subtasks\/2", "assignee_id": 0, "delegated_by_id": 0, "completed_on": null, "completed_by_id": null, "is_completed": false, "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "name": "Second subtask on Design task", "task_id": 2, "project_id": 1, "due_on": null } ], "task_list": { "id": 2, "class": "TaskList", "url_path": "\/projects\/1\/task-lists\/2", "name": "Design", "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "completed_on": null, "completed_by_id": null, "is_completed": false, "project_id": 1, "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "updated_by_id": 1, "start_on": 1412726400, "due_on": 1413158400, "position": 1, "open_tasks": 1, "completed_tasks": 0 }, "tracked_time": 0, "tracked_expenses": 0 }
To confirm that discussions are properly created, we'll get their 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": "Lets talk hm", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "About something else", "body_formatted": "About something else", "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "updated_by_id": 1 }, "subscribers": [ 1 ], "comments": [] }
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": 2, "class": "Discussion", "url_path": "\/projects\/1\/discussions\/2", "name": "Lets talk", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "About something", "body_formatted": "About something", "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "updated_by_id": 1 }, "subscribers": [ 1 ], "comments": [] }
We'll do the same for notes:
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
{ "single": { "id": 1, "class": "Note", "url_path": "\/projects\/1\/notes\/1", "name": "Main note", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "Main note body", "body_formatted": "Main note body", "body_plain_text": "Main note body", "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "updated_by_id": 1, "note_id": 0, "is_subnote": false, "subnotes_count": 1, "is_in_collection": true, "position": 0, "contributor_ids": [ 1 ] }, "subscribers": [ 1 ], "comments": [], "subnotes": [ { "id": 2, "class": "Note", "url_path": "\/projects\/1\/notes\/2", "name": "Sub-note", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "Sub-note body", "body_formatted": "Sub-note body", "body_plain_text": "Sub-note body", "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "updated_by_id": 1, "note_id": 1, "is_subnote": true, "subnotes_count": 0, "is_in_collection": true, "position": 1, "contributor_ids": [ 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
{ "single": { "id": 2, "class": "Note", "url_path": "\/projects\/1\/notes\/2", "name": "Sub-note", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "Sub-note body", "body_formatted": "Sub-note body", "body_plain_text": "Sub-note body", "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "updated_by_id": 1, "note_id": 1, "is_subnote": true, "subnotes_count": 0, "is_in_collection": true, "position": 1, "contributor_ids": [ 1 ] }, "subscribers": [ 1 ], "comments": [], "note": { "id": 1, "class": "Note", "url_path": "\/projects\/1\/notes\/1", "name": "Main note", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "Main note body", "body_formatted": "Main note body", "body_plain_text": "Main note body", "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "updated_by_id": 1, "note_id": 0, "is_subnote": false, "subnotes_count": 1, "is_in_collection": true, "position": 0, "contributor_ids": [ 1 ] } }
and files:
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
{ "single": { "id": 1, "class": "File", "url_path": "\/projects\/1\/files\/1", "name": "sketch.png", "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "mime_type": "image\/png", "size": 616656, "md5": null, "download_url": "http:\/\/feather.dev\/projects\/1\/files\/1\/download", "thumbnail_url": "http:\/\/feather.dev\/proxy.php?proxy=forward_thumbnail&module=system&v=current&b=DEV&context=upload&name=2015-04%2FEtIolhnVhOxVmgHhcENXHvi0pGHtU2PnkmBvuOgB&original_file_name=sketch.png&width=--WIDTH--&height=--HEIGHT--&ver=616656&scale=--SCALE--", "file_meta": { "kind": "image", "dimensions": { "width": 1800, "height": 400 } }, "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "updated_by_id": 1 } }
Project templates can be easily duplicated, to save you time:
Payload:
1 2 3
{ "name": "Design Project Copy" }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
{ "single": { "id": 3, "class": "ProjectTemplate", "url_path": "\/project-templates\/3", "name": "Design Project Copy", "members": [], "created_on": 1430164517, "created_by_id": 1, "updated_on": 1430164523, "is_draft": false, "is_scheduled": false, "count_task_lists": 0, "count_tasks": 0, "count_subtasks": 0, "count_discussions": 0, "count_files": 0, "count_notes": 0 } }
When project template gets dropped:
projects created based on it should have their template_id
flags updated:
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 90 91 92 93 94
{ "single": { "id": 1, "class": "Project", "url_path": "\/projects\/1", "name": "Project from Template", "completed_on": null, "completed_by_id": null, "is_completed": false, "members": [ 1, 3 ], "category_id": 0, "label_id": 0, "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164523, "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-GdtjZ0H@mail.manageprojects.com", "is_tracking_enabled": true, "is_client_reporting_enabled": false, "budget": null, "count_tasks": 2, "count_discussions": 2, "count_files": 1, "count_notes": 2 }, "category": null, "hourly_rates": { "1": 100 }, "label_ids": [ 5, 16 ], "task_lists": [ { "id": 1, "class": "TaskList", "url_path": "\/projects\/1\/task-lists\/1", "name": "Analyze", "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "completed_on": null, "completed_by_id": null, "is_completed": false, "project_id": 1, "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "updated_by_id": 1, "start_on": null, "due_on": null, "position": 1, "open_tasks": 1, "completed_tasks": 0 }, { "id": 2, "class": "TaskList", "url_path": "\/projects\/1\/task-lists\/2", "name": "Design", "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "completed_on": null, "completed_by_id": null, "is_completed": false, "project_id": 1, "created_on": 1430164521, "created_by_id": 1, "updated_on": 1430164521, "updated_by_id": 1, "start_on": 1412726400, "due_on": 1413158400, "position": 1, "open_tasks": 1, "completed_tasks": 0 } ] }