Project Names
Personas in this Story: Default, Member.
ActiveCollab offers a quick API command that can list only project names, mapped by their ID-s. This data is useful if you need to present project picker, but don't want to load the entire data set (active projects collection is paged to 100 records per request). To demonstrate, we have created three projects:
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
[ { "id": 1, "class": "Project", "url_path": "\/projects\/1", "name": "First project", "completed_on": null, "completed_by_id": null, "is_completed": false, "members": [ 1 ], "category_id": 0, "label_id": 0, "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "created_on": 1430164499, "created_by_id": 1, "updated_on": 1430164499, "updated_by_id": 1, "body": null, "body_formatted": "", "company_id": 1, "leader_id": 0, "currency_id": 2, "template_id": 0, "based_on_type": null, "based_on_id": null, "email": "notifications+m2p-d9XXuqg@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 }, { "id": 2, "class": "Project", "url_path": "\/projects\/2", "name": "Second project", "completed_on": null, "completed_by_id": null, "is_completed": false, "members": [ 1, 2 ], "category_id": 0, "label_id": 0, "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "created_on": 1430164499, "created_by_id": 1, "updated_on": 1430164499, "updated_by_id": 1, "body": null, "body_formatted": "", "company_id": 1, "leader_id": 0, "currency_id": 2, "template_id": 0, "based_on_type": null, "based_on_id": null, "email": "notifications+m2p-rSngQi0@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 }, { "id": 3, "class": "Project", "url_path": "\/projects\/3", "name": "Third project", "completed_on": null, "completed_by_id": null, "is_completed": false, "members": [ 1 ], "category_id": 0, "label_id": 0, "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "created_on": 1430164499, "created_by_id": 1, "updated_on": 1430164499, "updated_by_id": 1, "body": null, "body_formatted": "", "company_id": 1, "leader_id": 0, "currency_id": 2, "template_id": 0, "based_on_type": null, "based_on_id": null, "email": "notifications+m2p-AlsPfU8@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 } ]
We also have one completed project in the archive, to demonstrate that /projects/names only shows active projects:
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
[ { "id": 4, "class": "Project", "url_path": "\/projects\/4", "name": "Fourh project", "completed_on": 1430164500, "completed_by_id": 1, "is_completed": true, "members": [ 1, 2 ], "category_id": 0, "label_id": 0, "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "created_on": 1430164499, "created_by_id": 1, "updated_on": 1430164500, "updated_by_id": 1, "body": null, "body_formatted": "", "company_id": 1, "leader_id": 0, "currency_id": 2, "template_id": 0, "based_on_type": null, "based_on_id": null, "email": "notifications+m2p-iX1kbwZ@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 } ]
When owner tries to access the collection, all active projects will be presented:
Response:
1 2 3 4 5
{ "1": "First project", "2": "Second project", "3": "Third project" }
Member will see only active projects that they are assigned to:
Response:
1 2 3
{ "2": "Second project" }