Categories

System ships with no categories:

Response: HTTP 200, application/json (Hide)
GET /projects/categories

Response:

1
[]

Lets create a new project category:

Response: HTTP 200, application/json (Hide)
POST /categories

Payload:

1
2
3
4
{
    "type": "ProjectCategory",
    "name": "Marketing"
}

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
{
    "single": {
        "id": 1,
        "class": "ProjectCategory",
        "url_path": "\/categories\/1",
        "name": "Marketing",
        "parent_id": null,
        "parent_type": null,
        "created_on": 1430164037,
        "created_by_id": 1,
        "updated_on": 1430164037
    }
}

Lets rename a category:

Response: HTTP 200, application/json (Hide)
PUT /categories/1

Payload:

1
2
3
4
{
    "type": "ProjectCategory",
    "name": "Marketing Efforts"
}

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
{
    "single": {
        "id": 1,
        "class": "ProjectCategory",
        "url_path": "\/categories\/1",
        "name": "Marketing Efforts",
        "parent_id": null,
        "parent_type": null,
        "created_on": 1430164037,
        "created_by_id": 1,
        "updated_on": 1430164037
    }
}

Lets check the /categories listing now:

Response: HTTP 200, application/json (Hide)
GET /projects/categories

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
[
    {
        "id": 1,
        "class": "ProjectCategory",
        "url_path": "\/categories\/1",
        "name": "Marketing Efforts",
        "parent_id": null,
        "parent_type": null,
        "created_on": 1430164037,
        "created_by_id": 1,
        "updated_on": 1430164037
    }
]

Now, we can create a project:

Response: HTTP 200, application/json (Hide)
POST /projects

Payload:

1
2
3
4
5
{
    "name": "New project",
    "category_id": 1,
    "leader_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
{
    "single": {
        "id": 1,
        "class": "Project",
        "url_path": "\/projects\/1",
        "name": "New project",
        "completed_on": null,
        "completed_by_id": null,
        "is_completed": false,
        "members": [
            1
        ],
        "category_id": 1,
        "label_id": 0,
        "is_trashed": false,
        "trashed_on": null,
        "trashed_by_id": 0,
        "created_on": 1430164038,
        "created_by_id": 1,
        "updated_on": 1430164038,
        "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-yojwC9J@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": {
        "id": 1,
        "class": "ProjectCategory",
        "url_path": "\/categories\/1",
        "name": "Marketing Efforts",
        "parent_id": null,
        "parent_type": null,
        "created_on": 1430164037,
        "created_by_id": 1,
        "updated_on": 1430164037
    },
    "hourly_rates": {
        "1": 100
    },
    "label_ids": [],
    "task_lists": null
}

When we remove a category:

Response: HTTP 200, text/html
DELETE /categories/1

Project's category_id value should be reverted to 0:

Response: HTTP 200, application/json (Hide)
GET /projects/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
{
    "single": {
        "id": 1,
        "class": "Project",
        "url_path": "\/projects\/1",
        "name": "New 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": 1430164038,
        "created_by_id": 1,
        "updated_on": 1430164038,
        "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-yojwC9J@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
}