I’d like to use the REST API to create/update time logs from another system. I’m using the Pro Hosted version. The /tasks endpoint seems half baked to me…
Only returns properties id, description, and duration. Obvious missing things are client_id and date/time info.
I can’t figure out how to set date and duration.
Browsing the source, it looks like the timing information is stored in a JSON column in the database. That’s fine for me; pretty sure I could figure it out if I could just GET it back out again.
Am I right that the /tasks endpoint is sorta half-baked (or at least under-documented?) and are there any plans to improve it? Thanks for the info – just trying to validate that I’m not missing something obvious as I determine the best way to accomplish the integration. I’m actually trying to move away from FreshBooks and this is my first obstacle in that.
So, I still think there’s some real shoring up to make the /tasks endpoint more accessible, but I was able to POST the following to /tasks to create a task with time logs:
“description”: “test rest entry 3”
So time_log is an array of 2-part arrays; the numbers are start/stop strtotime() values.
Yes the Tasks API is incomplete. The API is being developed in parallel with our Mobile apps which are yet to implement Tasks.
The field list is quite extensive however, from the latest master branch I can see:
'id' => (int) $task->public_id,
'description' => $task->description,
'duration' => $task->getDuration(),
'updated_at' => (int) $this->getTimestamp($task->updated_at),
'archived_at' => (int) $this->getTimestamp($task->deleted_at),
'invoice_id' => $task->invoice ? (int) $task->invoice->public_id : false,
'client_id' => $task->client ? (int) $task->client->public_id : false,
'project_id' => $task->project ? (int) $task->project->public_id : false,
'is_deleted' => (bool) $task->is_deleted,
'time_log' => $task->time_log,
'is_running' => (bool) $task->is_running,
We are upgrading the Hosted version of InvoiceNinja in the next couple of days, so these additional fields will be available then.
I’m paying for hosting at app.invoiceninja.com – looks like I’m 2.8.1. I wonder how up-to-date invoiceninja.com keeps things.
Thanks for the info! --glad to know there’s active movement happening in that area.
Just logged in today and saw we’re updated to 2.9.5 and the task API is much more thorough now – yay! Very happy with that.