Projects
Response: HTTP 200, application/json (Hide)
GET /currencies
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
[ { "id": 3, "class": "Currency", "url_path": "\/currencies\/3", "name": "British Pound", "updated_on": null, "code": "GBP", "is_default": false, "decimal_spaces": 2, "decimal_rounding": 0 }, { "id": 1, "class": "Currency", "url_path": "\/currencies\/1", "name": "Euro", "updated_on": null, "code": "EUR", "is_default": false, "decimal_spaces": 2, "decimal_rounding": 0 }, { "id": 4, "class": "Currency", "url_path": "\/currencies\/4", "name": "Japanese Yen", "updated_on": null, "code": "JPY", "is_default": false, "decimal_spaces": 2, "decimal_rounding": 0 }, { "id": 2, "class": "Currency", "url_path": "\/currencies\/2", "name": "US Dollar", "updated_on": null, "code": "USD", "is_default": true, "decimal_spaces": 2, "decimal_rounding": 0 } ]
Response: HTTP 200, application/json (Hide)
POST /companies
Payload:
1 2 3 4
{ "name": "Client Company", "currency_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
{ "single": { "id": 2, "class": "Company", "url_path": "\/companies\/2", "name": "Client Company", "members": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "is_archived": false, "created_on": 1430164507, "created_by_id": 1, "updated_on": 1430164507, "updated_by_id": 1, "address": null, "phone": null, "homepage_url": null, "tax_id": null, "currency_id": 1, "is_owner": false, "has_note": false }, "hourly_rates": { "1": 100 }, "active_projects_count": 0 }
In order to list all active projects that authenticated user can see, we can simply send a GET request to /projects
resource:
As you can see, this request returns an empty array because we have no projects defined yet. Lets create one:
Response: HTTP 200, application/json (Hide)
POST /projects
Payload:
1 2 3 4 5 6 7 8 9
{ "name": "New projct", "company_id": 2, "leader_id": 1, "members": [ 1, 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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
{ "single": { "id": 1, "class": "Project", "url_path": "\/projects\/1", "name": "New projct", "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": 1430164507, "created_by_id": 1, "updated_on": 1430164507, "updated_by_id": 1, "body": null, "body_formatted": "", "company_id": 2, "leader_id": 1, "currency_id": 1, "template_id": 0, "based_on_type": null, "based_on_id": null, "email": "notifications+m2p-pNjJamX@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 }, "category": null, "hourly_rates": { "1": 100 }, "label_ids": [], "task_lists": null }
Great, now we have a project created. Lets see if /projects
listing is properly updated:
Response: HTTP 200, application/json (Hide)
GET /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": 1, "class": "Project", "url_path": "\/projects\/1", "name": "New projct", "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": 1430164507, "created_by_id": 1, "updated_on": 1430164507, "updated_by_id": 1, "body": null, "body_formatted": "", "company_id": 2, "leader_id": 1, "currency_id": 1, "template_id": 0, "based_on_type": null, "based_on_id": null, "email": "notifications+m2p-pNjJamX@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 } ]
Hm, it looks like we have mistyped the project name. Lets correct this:
Response: HTTP 200, application/json (Hide)
PUT /projects/1
Payload:
1 2 3
{ "name": "New 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 42 43 44 45 46
{ "single": { "id": 1, "class": "Project", "url_path": "\/projects\/1", "name": "New 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": 1430164507, "created_by_id": 1, "updated_on": 1430164508, "updated_by_id": 1, "body": null, "body_formatted": "", "company_id": 2, "leader_id": 1, "currency_id": 1, "template_id": 0, "based_on_type": null, "based_on_id": null, "email": "notifications+m2p-pNjJamX@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 }, "category": null, "hourly_rates": { "1": 100 }, "label_ids": [], "task_lists": null }
Sleeping for 1 seconds
Response: HTTP 200, application/json (Hide)
POST /projects
Payload:
1 2 3
{ "name": "Wizardry" }
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
{ "single": { "id": 2, "class": "Project", "url_path": "\/projects\/2", "name": "Wizardry", "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": 1430164509, "created_by_id": 1, "updated_on": 1430164509, "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-tBzzYHM@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 }, "category": null, "hourly_rates": { "1": 100 }, "label_ids": [], "task_lists": null }
and lets see if it goes to the top of the list:
Response: HTTP 200, application/json (Hide)
GET /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
[ { "id": 2, "class": "Project", "url_path": "\/projects\/2", "name": "Wizardry", "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": 1430164509, "created_by_id": 1, "updated_on": 1430164509, "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-tBzzYHM@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": 1, "class": "Project", "url_path": "\/projects\/1", "name": "New 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": 1430164507, "created_by_id": 1, "updated_on": 1430164508, "updated_by_id": 1, "body": null, "body_formatted": "", "company_id": 2, "leader_id": 1, "currency_id": 1, "template_id": 0, "based_on_type": null, "based_on_id": null, "email": "notifications+m2p-pNjJamX@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 } ]
Another way to sort projects is by name:
Response: HTTP 200, application/json (Hide)
GET /projects
Query Parameters:
1 2 3
{ "sort_by_name": true }
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
[ { "id": 1, "class": "Project", "url_path": "\/projects\/1", "name": "New 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": 1430164507, "created_by_id": 1, "updated_on": 1430164508, "updated_by_id": 1, "body": null, "body_formatted": "", "company_id": 2, "leader_id": 1, "currency_id": 1, "template_id": 0, "based_on_type": null, "based_on_id": null, "email": "notifications+m2p-pNjJamX@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": "Wizardry", "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": 1430164509, "created_by_id": 1, "updated_on": 1430164509, "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-tBzzYHM@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 } ]