Dailys
Docs

Categories

This section describes the API for accessing the organisation's categories. This will include all of the categories from the organisation that the authenticated category has access to.

Index

This API route will return a paginated list of all of the categories that belong to the organisation.

The index endpoint can be used as a reliable form of searching, as search results are paginated, and related resources of the category are also searched to increase the effeciveness of the search.

This resource requires authorisation. Please read the documentation on authorisation.

URI

GET https://api.dailys.nz/api/v1/categories

Parameters

Parameter Type Description
sortKey string The sort key specifies which resource attribute you want to search by.
sortAsc integer The sort asc defines if sorting should be ascending, accepts: 0 or 1.
query string The search term the category has provided, to refine results.
page integer The page number requested; used for pagination.
limit integer The number of resrouces per page; maximum: 100 minimum: 1

Allowed Sort Keys

name

Response

{
    "current_page": 1,
    "data": [
        {
            "id": 1,
            "name": "Internal",
            "created_at": "2000-01-01 00:00:00",
            "updated_at": "2000-01-01 00:00:00",
            "deleted_at": null,
            "tasks_count": 25,
            "charges_count": 15,
            "deleted": false
        },
        ...
    ],
    "from": 1,
    "last_page": 1,
    "next_page_url": null,
    "path": "https://api.dailys.nz/api/v1/categories",
    "per_page": 100,
    "prev_page_url": null,
    "to": 100,
    "total": 100
}

Store

This API route will allow you to store a new category entry. There are required fields, as the resource does not already exist.

This resource requires authorisation. Please read the documentation on authorisation.

URI

POST https://api.dailys.nz/api/v1/categories

Parameters

Parameter Required Type Description
name required string The unique name of the category.
charges optional array The array of charge ID's (as integers) to associate with the category with.
tasks optional array The array of task ID's (as integers) to associate with the category with.

Request

{
    "name": "My Category",
    "tasks": [
        1,
        2,
        3
    ],
    "charges": [
        4,
        12,
        30
    ]
}

Response

{
    "success": true,
    "category": {
        "id": 1,
        "name": "My Category",
        "created_at": "2000-01-01 00:00:00",
        "updated_at": "2000-01-01 00:00:00",
        "deleted_at": null,
        "tasks": [
            1,
            2,
            3
        ],
        "charges": [
            4,
            12,
            30
        ],
        "deleted": false
    }
}

Show

This API route will return the category's data, which includes the personal information as well as the settings that the category has selected for the application.

This resource requires authorisation. Please read the documentation on authorisation.

URI

GET https://api.dailys.nz/api/v1/categories/:CATEGORY_ID

Response

{
    "id": 1,
    "name": "My Category",
    "created_at": "2000-01-01 00:00:00",
    "updated_at": "2000-01-01 00:00:00",
    "deleted_at": null,
    "tasks": [
        1,
        2,
        3
    ],
    "charges": [
        4,
        12,
        30
    ],
    "projects": [
        1,
        2,
        3,
        4,
        5
    ],
    "deleted": false
}

Update

This API route will allow you to update category entry. As this resource already exists, there are no required fields, so you can send as many or as few parameters as you would like.

This resource requires authorisation. Please read the documentation on authorisation.

URI

PUT https://api.dailys.nz/api/v1/categories/:CATEGORY_ID

Parameters

Parameter Type Description
name string The unique name of the category.
charges array The array of charge ID's (as integers) to associate with the category with.
tasks array The array of task ID's (as integers) to associate with the category with.

Request

{
  "name": "A different name."
}

Response

{
    "success": true,
    "category": {
        "id": 1,
        "name": "A different name.",
        "created_at": "2000-01-01 00:00:00",
        "updated_at": "2000-01-01 00:00:00",
        "deleted_at": null,
        "tasks": [
            1,
            2,
            3
        ],
        "charges": [
            4,
            12,
            30
        ],
        "deleted": false
    }
}

Destroy

This API route will allow you to delete a category entry. This category will no long be accessible using this API endpoint, however the category can be restored from the archives and the category will then be re-activated.

This resource requires authorisation. Please read the documentation on authorisation.

URI

DELETE https://api.dailys.nz/api/v1/categories/:CATEGORY_ID

Response

{
    "success": true,
    "category": {
        "id": 1,
        "name": "A different name.",
        "created_at": "2000-01-01 00:00:00",
        "updated_at": "2000-01-01 00:00:00",
        "deleted_at": null,
        "tasks": [
            1,
            2,
            3
        ],
        "charges": [
            4,
            12,
            30
        ],
        "deleted": false
    }
}