Timetracking

Resource Fields

Name Type Read-only Description
id Int
time_tracking_log_id Int
case Case
agent User
creator User The person who created this log (can be different than agent if entry is created by some admin)
log_type String VIEWED | WORKED | BILLED
time_spent Int Value should be greater than 0. duh!
created_at Int
resource_type Int
resource_url Int

Metadata




 
 




Actions

Retrieve all timetracking logs

GET /api/v1/timetracking.json

Retrieves a paginated list of all the timetracking log entries

Information

Allowed for Collaborators, Agents, Admins & Owners
Ordered by created_at (ascending)

Response

{
        "status": 200,
    "data": [
        {
            "id": 1,
            "time_tracking_log_id": 1,
            "case": {
                "id": 1,
                "resource_type": "case"
            },
            "agent": {
                "id": 5,
                "resource_type": "user"
            },
            "log_type": "WORKED",
            "time_spent": 467,
            "creator": {
                "id": 1,
                "resource_type": "user"
            },
            "created_at": 1498466226,
            "resource_type": "timetracking_log",
            "resource_url": "https://brewfictus.kayako.com/api/v1/cases/time_track/log/1"
        },
        {
            "id": 2,
            "time_tracking_log_id": 2,
            "case": {
                "id": 1,
                "resource_type": "case"
            },
            "agent": {
                "id": 5,
                "resource_type": "user"
            },
            "log_type": "WORKED",
            "time_spent": 682,
            "creator": {
                "id": 1,
                "resource_type": "user"
            },
            "created_at": 1498466226,
            "resource_type": "timetracking_log",
            "resource_url": "https://brewfictus.kayako.com/api/v1/cases/time_track/log/2"
        },
        {
            "id": 3,
            "time_tracking_log_id": 3,
            "case": {
                "id": 1,
                "resource_type": "case"
            },
            "agent": {
                "id": 2,
                "resource_type": "user"
            },
            "log_type": "WORKED",
            "time_spent": 138,
            "creator": {
                "id": 1,
                "resource_type": "user"
            },
            "created_at": 1498466226,
            "resource_type": "timetracking_log",
            "resource_url": "https://brewfictus.kayako.com/api/v1/cases/time_track/log/3"
        },
        {
            "id": 4,
            "time_tracking_log_id": 4,
            "case": {
                "id": 1,
                "resource_type": "case"
            },
            "agent": {
                "id": 4,
                "resource_type": "user"
            },
            "log_type": "BILLED",
            "time_spent": 807,
            "creator": {
                "id": 1,
                "resource_type": "user"
            },
            "created_at": 1498466228,
            "resource_type": "timetracking_log",
            "resource_url": "https://brewfictus.kayako.com/api/v1/cases/time_track/log/4"
        },
        {
            "id": 5,
            "time_tracking_log_id": 5,
            "case": {
                "id": 1,
                "resource_type": "case"
            },
            "agent": {
                "id": 2,
                "resource_type": "user"
            },
            "log_type": "BILLED",
            "time_spent": 689,
            "creator": {
                "id": 1,
                "resource_type": "user"
            },
            "created_at": 1498466229,
            "resource_type": "timetracking_log",
            "resource_url": "https://brewfictus.kayako.com/api/v1/cases/time_track/log/5"
        },
        {
            "id": 6,
            "time_tracking_log_id": 6,
            "case": {
                "id": 1,
                "resource_type": "case"
            },
            "agent": {
                "id": 5,
                "resource_type": "user"
            },
            "log_type": "WORKED",
            "time_spent": 436,
            "creator": {
                "id": 1,
                "resource_type": "user"
            },
            "created_at": 1498466229,
            "resource_type": "timetracking_log",
            "resource_url": "https://brewfictus.kayako.com/api/v1/cases/time_track/log/6"
        },
        {
            "id": 7,
            "time_tracking_log_id": 7,
            "case": {
                "id": 1,
                "resource_type": "case"
            },
            "agent": {
                "id": 4,
                "resource_type": "user"
            },
            "log_type": "WORKED",
            "time_spent": 361,
            "creator": {
                "id": 1,
                "resource_type": "user"
            },
            "created_at": 1498466229,
            "resource_type": "timetracking_log",
            "resource_url": "https://brewfictus.kayako.com/api/v1/cases/time_track/log/7"
        },
        {
            "id": 8,
            "time_tracking_log_id": 8,
            "case": {
                "id": 1,
                "resource_type": "case"
            },
            "agent": {
                "id": 1,
                "resource_type": "user"
            },
            "log_type": "VIEWED",
            "time_spent": 896,
            "creator": {
                "id": 1,
                "resource_type": "user"
            },
            "created_at": 1498466229,
            "resource_type": "timetracking_log",
            "resource_url": "https://brewfictus.kayako.com/api/v1/cases/time_track/log/8"
        },
        {
            "id": 9,
            "time_tracking_log_id": 9,
            "case": {
                "id": 1,
                "resource_type": "case"
            },
            "agent": {
                "id": 4,
                "resource_type": "user"
            },
            "log_type": "BILLED",
            "time_spent": 263,
            "creator": {
                "id": 1,
                "resource_type": "user"
            },
            "created_at": 1498466231,
            "resource_type": "timetracking_log",
            "resource_url": "https://brewfictus.kayako.com/api/v1/cases/time_track/log/9"
        },
        {
            "id": 10,
            "time_tracking_log_id": 10,
            "case": {
                "id": 1,
                "resource_type": "case"
            },
            "agent": {
                "id": 2,
                "resource_type": "user"
            },
            "log_type": "WORKED",
            "time_spent": 954,
            "creator": {
                "id": 1,
                "resource_type": "user"
            },
            "created_at": 1498466232,
            "resource_type": "timetracking_log",
            "resource_url": "https://brewfictus.kayako.com/api/v1/cases/time_track/log/10"
        }
    ],
    "resource": "timetracking_log",
    "offset": 0,
    "limit": 10,
    "total_count": 71,
    "next_url": "https://brewfictus.kayako.com/api/v1/timetracking?offset=10",
    "last_url": "https://brewfictus.kayako.com/api/v1/timetracking?offset=70"
}

Add timetracking log

POST /api/v1/timetracking.json

Add a new time tracking log entry

Information

Allowed for Collaborators, Agents, Admins & Owners

Data

Name Type Mandatory Description
case_id Int
ID of the case
log_type String
one of [VIEWED, WORKED, BILLED]
time_spent Int Value in seconds. Mandatory if log_type is not VIEWED
agent_id Int The agent for which this entry is (only allowed for admins)

Response

{
    "status": 200,
    "data": {
        "id": 72,
        "time_tracking_log_id": 72,
        "case": {
            "id": 1,
            "resource_type": "case"
        },
        "agent": {
            "id": 1,
            "resource_type": "user"
        },
        "log_type": "BILLED",
        "time_spent": 9,
        "creator": {
            "id": 1,
            "resource_type": "user"
        },
        "created_at": 1498467014,
        "resource_type": "timetracking_log",
        "resource_url": "https://brewfictus.kayako.com/api/v1/cases/time_track/log/72"
    },
    "resource": "timetracking_log"
}

Modify timetracking log

PUT /api/v1/timetracking/:id

Modifies an already created time tracking log entry

Information

Allowed for Agents, Admins & Owners

Data

Name Type Mandatory Description
time_spent integer
This value will add to the previous value of time_spent if this entry is of VIEWED type otherwise it will replace the present value.
log_type string Change log_type. Allowed values are WORKED and BILLED. Only applicable if log_type is WORKED and BILLED

Response

{
    "status": 200,
    "data": {
        "id": 72,
        "time_tracking_log_id": 72,
        "case": {
            "id": 1,
            "resource_type": "case"
        },
        "agent": {
            "id": 1,
            "resource_type": "user"
        },
        "log_type": "BILLED",
        "time_spent": 18,
        "creator": {
            "id": 1,
            "resource_type": "user"
        },
        "created_at": 1498467014,
        "resource_type": "timetracking_log",
        "resource_url": "https://brewfictus.kayako.com/api/v1/cases/time_track/log/72"
    },
    "resource": "timetracking_log"
}

Retrive activity entries

GET /api/v1/timetracking/activity

All the `VIEWED` timetracking logs are classifed as activity logs and can be viewd on this endpoint. The differece is that this is aggregated based on case and agent.

Information

Allowed for Collaborators, Agents, Admins & Owners

Parameters

Name Type Mandatory Description
case_id string
case id

Response

{
    "status": 200,
    "data": [
        {
            "id": 1,
            "case": {
                "id": 1,
                "resource_type": "case"
            },
            "agent": {
                "id": 1,
                "resource_type": "user"
            },
            "log_type": "VIEWED",
            "total_time_spent": 4142
        },
        {
            "id": 2,
            "case": {
                "id": 1,
                "resource_type": "case"
            },
            "agent": {
                "id": 2,
                "resource_type": "user"
            },
            "log_type": "VIEWED",
            "total_time_spent": 4200
        },
        {
            "id": 4,
            "case": {
                "id": 1,
                "resource_type": "case"
            },
            "agent": {
                "id": 4,
                "resource_type": "user"
            },
            "log_type": "VIEWED",
            "total_time_spent": 189
        },
        {
            "id": 5,
            "case": {
                "id": 1,
                "resource_type": "case"
            },
            "agent": {
                "id": 5,
                "resource_type": "user"
            },
            "log_type": "VIEWED",
            "total_time_spent": 1655
        }
    ],
    "resource": "timetracking_activity",
    "total_count": 4
}

Retrive tracked entries

GET /api/v1/timetracking/tracked

All the `WORKED` and `BILLED` timetracking logs are classifed as tracked logs and can be viewd on this endpoint. This also returns the current aggregate sum.

Information

Allowed for Collaborators, Agents, Admins & Owners

Parameters

Name Type Mandatory Description
case_id string
case id

Response

{
    "status": 200,
    "data": {
        "id": null,
        "billed": 9721,
        "worked": 25089,
        "total_count": 20,
        "entries": [
            {
                "id": 1,
                "resource_type": "timetracking_log"
            },
            {
                "id": 2,
                "resource_type": "timetracking_log"
            },
            {
                "id": 3,
                "resource_type": "timetracking_log"
            },
            {
                "id": 4,
                "resource_type": "timetracking_log"
            },
            {
                "id": 5,
                "resource_type": "timetracking_log"
            },
            {
                "id": 6,
                "resource_type": "timetracking_log"
            },
            {
                "id": 7,
                "resource_type": "timetracking_log"
            },
            {
                "id": 9,
                "resource_type": "timetracking_log"
            },
            {
                "id": 10,
                "resource_type": "timetracking_log"
            },
            {
                "id": 13,
                "resource_type": "timetracking_log"
            }
        ],
        "resource_type": "timetracking_tracked",
        "resource_url": null
    },
    "resource": "timetracking_tracked"
}