Dailys
Docs

Users

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

Index

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

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 user 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, email

Response

{
    "current_page": 1,
    "data": [
        {
            "id": 1,
            "name": "Acme User",
            "email": "[email protected]",
            "email_2": null,
            "created_at": "2000-01-01 00:00:00",
            "updated_at": "2000-01-01 00:00:00",
            "organisations_count": 1,
            "users_count": 0,
            "clients_count": 0,
            "projects_count": 200,
            "invoices_count": 0,
            "organisation_assignment": {
                "permissions": {
                    ...
                },
                "metadata": {
                    "phone": null,
                    "position": null,
                    "department": null,
                    "bio": null,
                    "capacity": 2400,
                    "capacity_type": "weekly",
                    "default_rate": 15000,
                    "emails": {
                        "projects": true
                    },
                    "format_timezone": "Pacific/Auckland",
                    "format_date": "YYYY-MM-DD",
                    "format_time": "HH:MM",
                    "format_week": "Monday"
                },
                "allPermissions": {
                    ...
                },
                "role": {
                    "id": 1,
                    "scope": "organisations",
                    "name": "Administrator",
                    "description": "Administer the organisation and users.",
                    "permissions": {
                        ...
                    },
                    "created_at": "2000-01-01 00:00:00",
                    "updated_at": "2000-01-01 00:00:00",
                    "deleted_at": null,
                    "deleted": false
                }
            },
            "assignment": null,
            "current": false,
            "owner": true
        },
        ...
    ],
    "from": 1,
    "last_page": 2,
    "next_page_url": "https://api.dailys.nz/api/v1/users?page=2",
    "path": "https://api.dailys.nz/api/v1/users",
    "per_page": 5,
    "prev_page_url": null,
    "to": 5,
    "total": 10
}

Show

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

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

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

URI

GET https://api.dailys.nz/api/v1/users/:USER_ID

Response

{
    "id": 1,
    "name": "Acme User",
    "email": "[email protected]",
    "email_2": null,
    "created_at": "2000-01-01 00:00:00",
    "updated_at": "2000-01-01 00:00:00",
    "organisation_assignment": {
        "permissions": {
            ...
        },
        "metadata": {
            "phone": null,
            "position": null,
            "department": null,
            "bio": null,
            "capacity": 2400,
            "capacity_type": "weekly",
            "default_rate": 15000,
            "emails": {
                "projects": true
            },
            "format_timezone": "Pacific/Auckland",
            "format_date": "YYYY-MM-DD",
            "format_time": "HH:MM AM",
            "format_week": "Monday"
        },
        "allPermissions": {
            ...
        },
        "role": {
            "id": 1,
            "scope": "organisations",
            "name": "Administrator",
            "description": "Administer the organisation and users.",
            "permissions": {
                ...
            },
            "created_at": "2000-01-01 00:00:00",
            "updated_at": "2000-01-01 00:00:00",
            "deleted_at": null,
            "deleted": false
        }
    },
    "assignment": null,
    "current": true,
    "owner": false
}

Update

This API route will allow you to update user details. 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/users/:USER_ID

Parameters

Parameter Type Description
name string The full name for your account details.
email email A valid email address that will be used as the primary contact, i.e. company email.
email_2 email A valid email address that can be used for contact information, i.e. personal email.
organisation_assignment object The organisation assigmment object, for acl and metadata information.

organisation_assignment Parameters

Parameter Type Description
metadata object The meta data for key-value pairs of information which can be specified fields and user specified.
metadata.phone string The contact phone number for the user.
metadata.position string The position or job title that the user holds within the organisation.
metadata.department string The department within the organisation that the user works in.
metadata.bio string The personal biography for the user.
metadata.format_timezone timezone The timezone preference for the user.
metadata.format_date format The date format preference for the user.
metadata.format_time format The time format preference for the user.
metadata.format_week week The day of the week that the user considers to be the start of week.

Request

{
  "name": "Another Acme Name"
}

Response

{
    "success": true,
    "user": {
        "id": 1,
        "name": "Another Acme User",
        "email": "[email protected]",
        "email_2": null,
        "created_at": "2000-01-01 00:00:00",
        "updated_at": "2000-01-01 00:00:00",
        "organisation_assignment": {
            "permissions": {
                ...
            },
            "metadata": {
                "phone": null,
                "position": null,
                "department": null,
                "bio": null,
                "capacity": 2400,
                "capacity_type": "weekly",
                "default_rate": 15000,
                "emails": {
                    "projects": true
                },
                "format_timezone": "Pacific/Auckland",
                "format_date": "YYYY-MM-DD",
                "format_time": "HH:MM AM",
                "format_week": "Monday"
            },
            "allPermissions": {
                ...
            },
            "role": {
                "id": 1,
                "scope": "organisations",
                "name": "Administrator",
                "description": "Administer the organisation and users.",
                "permissions": {
                    ...
                },
                "created_at": "2000-01-01 00:00:00",
                "updated_at": "2000-01-01 00:00:00",
                "deleted_at": null,
                "deleted": false
            }
        },
        "assignment": null,
        "current": true,
        "owner": false
    }
}

Destroy

This API route will allow you to archive a user. This user will no long be accessible using this API endpoint, however the user can be restored from the archives and the user will then be re-activated. This action will effect the billing of the organisation, as organisations are only charged for active users.

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

URI

DELETE https://api.dailys.nz/api/v1/users/:USER_ID

Response

{
    "success": true,
    "user": {
        "id": 1,
        "name": "Acme User",
        "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
    }
}