Actuals

Actuals endpoint enables you to get information of actual working hours reported by users to projects. Endpoint's URL is:

https://<your_environment_url>/customer-api/1.0/actuals/

GET


When calling /actuals/ endpoint without parameters you will get all the actual hours from the database. Example response:
{
    "count": 1,
    "csvUrl": "/customer-api/1.0/actuals/?user.id=1&csv=true&actual.date=2019-09-12",
    "itemsPerPage": 500,
    "excelUrl": "/customer-api/1.0/actuals/?user.id=1&excel=true&actual.date=2019-09-12",
    "next": null,
    "current": 1,
    "lastPage": 1,
    "data": [
        {
            "id": 554,
            "created": "2019-09-09T09:07:06.992139",
            "modified": "2019-09-09T09:07:06.992147",
            "date": "2019-09-12",
            "hours": "1.00",
            "hourly_rate": "20.00",
            "note": "internal testing",
            "task": 1,
            "employee": 1,
            "invoice": null,
            "external_id": "EXTSYS1234",
            "modified_external": "2019-09-09T09:07:06.992147"
        }
    ],
    "previous": null
}

POST


You can add actual hour records with POST method to the same URL than GET. POST body contains data for actual hour's record data in JSON format. Successful call will give response code 201 and return the newly created actual hour record's JSON. Minimum JSON for adding actual hours is:
{
    "date": "YYYY-MM-DD",
    "hours": "<DECIMAL(10, 2)>",
    "task": <projecttask_id>,
    "employee": <user_id>
}

To add multiple records you may use POST with a list of JSON objects.
[
{
    "date": "YYYY-MM-DD",
    "hours": "<DECIMAL(10, 2)>",
    "task": <projecttask_id>,
    "employee": <user_id>
},
{
    "date": "YYYY-MM-DD",
    "hours": "<DECIMAL(10, 2)>",
    "task": <projecttask_id>,
    "employee": <user_id>
},
{
    "date": "YYYY-MM-DD",
    "hours": "<DECIMAL(10, 2)>",
    "task": <projecttask_id>,
    "employee": <user_id>
},
]

Below is an example of which metadata fields you can add with /actuals/ endpoint:
{
    "date": "YYYY-MM-DD",
    "hours": "<DECIMAL(10, 2)>",
    "hourly_rate": "<DECIMAL(10, 2)>",
    "note": "<string>",
    "task": <projecttask_id>,
    "employee": <user_id>,
    "external_id": "<string>",
    "modified_external": "<DATETIME>"
}

PATCH


If you want to modify some record, it can be done with the PATCH method. URL for the PATCH must include the record's ID which you wish to edit:
https://<your_environment_url>/customer-api/1.0/actuals/<id>/
In message body you should deliver the edited fields. You can edit all the fields which are available for POSTing.

How did we do with this article?