Dailys
Docs

Times

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

Index

This API route will return a paginated list of all of the times 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 time 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/times

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 time 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
date date The optional filter to constrain the time entries to a single day, format: YYYY-MM-DD.

Allowed Sort Keys

date, start, task.name, project.name, project.code, user.name

Response

{
    "current_page": 1,
    "data": [
        {
            "id": 1,
            "date": "2000-01-01",
            "start": 360,
            "total": 405,
            "quantity": 27,
            "increment": 15,
            "rate": 12000,
            "notes": null,
            "currency": "NZD",
            "created_at": "2000-01-01 00:00:00",
            "updated_at": "2000-01-01 00:00:00",
            "project": {
                "id": 1,
                "name": "Example Project",
                "code": "1000",
                "status": "incomplete",
                "type": "client",
                "deleted": false,
                "client": {
                    "id": 1,
                    "name": "ABC Limited",
                    "code": "ABC",
                    "deleted": false
                }
            },
            "task": {
                "id": 1,
                "name": "Meeting",
                "deleted": false
            }
        },
        ...
    ],
    "from": 1,
    "last_page": 1,
    "next_page_url": null,
    "path": "https://api.dailys.nz/api/v1/times",
    "per_page": 100,
    "prev_page_url": null,
    "to": 100,
    "total": 100000
}

Store

This API route will allow you to store a new time entry. There are required fields, as the resource does not already exist. There as some business rules associated with making time entries:

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

URI

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

Parameters

Parameter Required Type Description
project_id required integer The ID of the project that the time entry should log to.
task_id required integer The ID of the task that the time entry for the project should be associated with.
date required date The date the time entry should refer to. These can be made in advance.
start required integer The start time for the time entry, in minutes from the beginning of the day.
quantity required integer The number of time increments to log with the time entry.
notes optional string Any notes or descriptions related to the time entry.

Request

{
    "project_id": 1,
    "task_id": 1,
    "date": "2000-01-01",
    "start": 0,
    "quantity": 10,
    "notes": "Some notes on what was worked on during this time."
}

Response

{
    "success": true,
    "time": {
        "id": 1,
        "date": "2000-01-01",
        "start": 0,
        "total": 150,
        "quantity": 15,
        "increment": 10,
        "rate": 15000,
        "notes": "Some notes on what was worked on during this time.",
        "currency": "NZD",
        "created_at": "2000-01-01 00:00:00",
        "updated_at": "2000-01-01 00:00:00",
        "project": {
            "id": 1,
            "status": "incomplete",
            "name": "Example Project",
            "code": "1000",
            "description": "An example project",
            "currency": "NZD",
            "increment": 15,
            "budget": null,
            "budget_type": null,
            "start_date": "2001-01-01",
            "end_date": null,
            "created_at": "2000-01-01 00:00:00",
            "updated_at": "2000-01-01 00:00:00",
            "type": "client",
            "deleted": false,
            "client": {
                "id": 1,
                "code": "ABC",
                "name": "ABC Limited",
                "phone": null,
                "fax": null,
                "created_at": "2000-01-01 00:00:00",
                "updated_at": "2000-01-01 00:00:00",
                "deleted": false,
                "contact": {
                    "id": 306,
                    "name": "Mr ABC",
                    "email": "[email protected]",
                    "phone": null,
                    "mobile": "021 234 5678",
                    "primary": true
                },
                "address": {
                    "street": "123 Test Street",
                    "street_2": null,
                    "suburb": null,
                    "city": "Dunedin",
                    "state": null,
                    "postal": "9000",
                    "country": "NZ"
                },
                "postal": {
                    "street": "123 Test Street",
                    "street_2": null,
                    "suburb": null,
                    "city": "Dunedin",
                    "state": null,
                    "postal": "9000",
                    "country": "NZ"
                }
            }
        },
        "task": {
            "id": 1,
            "name": "Meeting",
            "created_at": "2000-01-01 00:00:00",
            "updated_at": "2000-01-01 00:00:00",
            "deleted": false
        }
    }
}

Show

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

This data also includes a listing of all of the assigned permissions that the time has, a long with the currently assigned roles that the time has.

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

URI

GET https://api.dailys.nz/api/v1/times/:TIME_ID

Response

{
    "id": 1,
    "date": "2000-01-01",
    "start": 360,
    "total": 405,
    "quantity": 27,
    "increment": 15,
    "rate": 15000,
    "notes": null,
    "currency": "NZD",
    "created_at": "2000-01-01 00:00:00",
    "updated_at": "2000-01-01 00:00:00",
    "project": {
        "id": 1,
        "status": "incomplete",
        "name": "Example Project",
        "code": "1000",
        "description": "An example project",
        "currency": "NZD",
        "increment": 15,
        "budget": null,
        "budget_type": null,
        "start_date": "2001-01-01",
        "end_date": null,
        "created_at": "2000-01-01 00:00:00",
        "updated_at": "2000-01-01 00:00:00",
        "type": "client",
        "deleted": false,
        "client": {
            "id": 1,
            "code": "ABC",
            "name": "ABC Limited",
            "phone": null,
            "fax": null,
            "created_at": "2000-01-01 00:00:00",
            "updated_at": "2000-01-01 00:00:00",
            "deleted": false,
            "contact": {
                "id": 306,
                "name": "Mr ABC",
                "email": "[email protected]",
                "phone": null,
                "mobile": "021 234 5678",
                "primary": true
            },
            "address": {
                "street": "123 Test Street",
                "street_2": null,
                "suburb": null,
                "city": "Dunedin",
                "state": null,
                "postal": "9000",
                "country": "NZ"
            },
            "postal": {
                "street": "123 Test Street",
                "street_2": null,
                "suburb": null,
                "city": "Dunedin",
                "state": null,
                "postal": "9000",
                "country": "NZ"
            }
        }
    },
    "task": {
        "id": 1,
        "name": "Meeting",
        "created_at": "2000-01-01 00:00:00",
        "updated_at": "2000-01-01 00:00:00",
        "deleted": false
    }
}

Update

This API route will allow you to update time 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/times/:TIME_ID

Parameters

Parameter Type Description
project_id integer The ID of the project that the time entry should log to.
task_id integer The ID of the task that the time entry for the project should be associated with.
date date The date the time entry should refer to. These can be made in advance.
start integer The start time for the time entry, in minutes from the beginning of the day.
quantity integer The number of time increments to log with the time entry.
notes string Any notes or descriptions related to the time entry.

Request

{
  "notes": "Some different notes all together."
}

Response

{
    "success": true,
    "time": {
        "id": 1,
        "date": "2000-01-01",
        "start": 0,
        "total": 150,
        "quantity": 15,
        "increment": 10,
        "rate": 15000,
        "notes": "Some different notes all together.",
        "currency": "NZD",
        "created_at": "2000-01-01 00:00:00",
        "updated_at": "2000-01-01 00:00:00",
        "project": {
            "id": 1,
            "status": "incomplete",
            "name": "Example Project",
            "code": "1000",
            "description": "An example project",
            "currency": "NZD",
            "increment": 15,
            "budget": null,
            "budget_type": null,
            "start_date": "2001-01-01",
            "end_date": null,
            "created_at": "2000-01-01 00:00:00",
            "updated_at": "2000-01-01 00:00:00",
            "type": "client",
            "deleted": false,
            "client": {
                "id": 1,
                "code": "ABC",
                "name": "ABC Limited",
                "phone": null,
                "fax": null,
                "created_at": "2000-01-01 00:00:00",
                "updated_at": "2000-01-01 00:00:00",
                "deleted": false,
                "contact": {
                    "id": 306,
                    "name": "Mr ABC",
                    "email": "[email protected]",
                    "phone": null,
                    "mobile": "021 234 5678",
                    "primary": true
                },
                "address": {
                    "street": "123 Test Street",
                    "street_2": null,
                    "suburb": null,
                    "city": "Dunedin",
                    "state": null,
                    "postal": "9000",
                    "country": "NZ"
                },
                "postal": {
                    "street": "123 Test Street",
                    "street_2": null,
                    "suburb": null,
                    "city": "Dunedin",
                    "state": null,
                    "postal": "9000",
                    "country": "NZ"
                }
            }
        },
        "task": {
            "id": 1,
            "name": "Meeting",
            "created_at": "2000-01-01 00:00:00",
            "updated_at": "2000-01-01 00:00:00",
            "deleted": false
        }
    }
}

Destroy

This API route will allow you to delete a time entry. This time will no long be accessible using this API endpoint. There is no archive functionality for time entries, so deleting time entries will permanently remove them.

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

URI

DELETE https://api.dailys.nz/api/v1/times/:TIME_ID

Response

{
    "success": true,
    "time": {
        "id": 1,
        "name": "Acme time",
        "email": "[email protected]",
        "email_2": null,
        "created_at": "2000-01-01 00:00:00",
        "updated_at": "2000-01-01 00:00:00",
        "current": false,
        "owner": false
    }
}