Timeslips did not import duration

I managed to import a load of timeslips (exported from Toggl), following
instructions here https://dev.freeagent.com/docs/timeslips
But none of the duration came through, even though they were formatted as
numeric hours and didn’t throw any errors:

Here is an example of a timeslip being imported:

{
“user”: “https://api.freeagent.com/company/users/xxx”,
“client”: "https://api.freeagent.com/contacts/xxx
“project”: "https://api.freeagent.com/projects/xxx
“task”: "https://api.freeagent.com/projects/xxx/tasks/xxx
“comment”: “some work and setup”,
“dated_on”: “2014-12-23”,
“duration”: “0.58”
}

Any ideas what I’m doing wrong?

Thanks,

Tom

Open Code Limited is a company registered at:
Well Cottage, 2 Blankstones Farm, 39 Acre End Street, Eynsham OX29 4PF.
Company nº 9301422 in England and Wales.

Hi Tom,

Sorry to say the API doesn’t currently support generic bulk operations,
only the few special cases listed in the documentation. You should be able
to issue a GET, find the affected slips and (as you suggest) merge with
your original source JSON to craft some updates, but each of these will
have to be issued individually as a PUT against the appropriate slip’s URL.

Alternatively, you could delete each affected slip and re-issue the (fixed)
bulk create request, but each DELETE would also have to be issued
individually.

Hope this helps a bit!

-JOn Tue, Dec 30, 2014 at 10:02 AM, waako tom@opencode.limited wrote:

Now I just have to clean up my mess!
Is there a way of bulk deleting timeslips so I can properly import them
all from scratch?

Alternatively I guess I could do a get and then merge that output with the
initial json which has hours value, and hope that I can put the updated
timeslips, but from documentation not sure if it is possible to bulk
put/update timeslips.

Many thanks!


Open Code Limited is a company registered at:
Well Cottage, 2 Blankstones Farm, 39 Acre End Street, Eynsham OX29 4PF.
Company nº 9301422 in England and Wales.


You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to freeagent_api+unsubscribe@googlegroups.com.
To post to this group, send email to freeagent_api@googlegroups.com.
Visit this group at http://groups.google.com/group/freeagent_api.
For more options, visit https://groups.google.com/d/optout.

Jonathan Barrett, Senior Engineer

FreeAgent: Accounting software, simplified

+44 (0)131 447 0011

Follow us on Twitter: @freeagent https://twitter.com/freeagent

FreeAgent Central Ltd, 40 Torphichen Street, Edinburgh EH3 8JB
Registered in Scotland SC316774

Hi Tom,

Glad some fresh eyes helped!

-JOn Mon, Dec 29, 2014 at 10:27 PM, waako tom@opencode.limited wrote:

Yup, that worked fine thank you.

I could have sworn that I’d tested it in sandbox and it worked, but serve
me right for working late.

As a consequence, is there a way to bulk delete timeslips?

On Monday, 29 December 2014 18:40:38 UTC, Jonathan Barrett wrote:

Hi Tom,

Looking at the request (and our logs), it looks like you’ve got a few
parameter names wrong, specifically “duration” (should be “hours”),
“client” (should be “contact”) and you don’t associate a timeslip directly
with a “project”, only with a “task” (which in turn is related to a
project). If you fix up the params you should be fine.

Let me know if this doesn’t help,

-J


Open Code Limited is a company registered at:
Well Cottage, 2 Blankstones Farm, 39 Acre End Street, Eynsham OX29 4PF.
Company nº 9301422 in England and Wales.


You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to freeagent_api+unsubscribe@googlegroups.com.
To post to this group, send email to freeagent_api@googlegroups.com.
Visit this group at http://groups.google.com/group/freeagent_api.
For more options, visit https://groups.google.com/d/optout.

Jonathan Barrett, Senior Engineer

FreeAgent: Accounting software, simplified

+44 (0)131 447 0011

Follow us on Twitter: @freeagent https://twitter.com/freeagent

FreeAgent Central Ltd, 40 Torphichen Street, Edinburgh EH3 8JB
Registered in Scotland SC316774

Now I just have to clean up my mess!
Is there a way of bulk deleting timeslips so I can properly import them all from scratch?

Alternatively I guess I could do a get and then merge that output with the initial json which has hours value, and hope that I can put the updated timeslips, but from documentation not sure if it is possible to bulk put/update timeslips.

Many thanks!

Open Code Limited is a company registered at:
Well Cottage, 2 Blankstones Farm, 39 Acre End Street, Eynsham OX29 4PF.
Company nº 9301422 in England and Wales.

Hi Tom,

Looking at the request (and our logs), it looks like you’ve got a few
parameter names wrong, specifically “duration” (should be “hours”),
“client” (should be “contact”) and you don’t associate a timeslip directly
with a “project”, only with a “task” (which in turn is related to a
project). If you fix up the params you should be fine.

Let me know if this doesn’t help,

-J

Yup, that worked fine thank you.

I could have sworn that I’d tested it in sandbox and it worked, but serve
me right for working late.

As a consequence, is there a way to bulk delete timeslips?On Monday, 29 December 2014 18:40:38 UTC, Jonathan Barrett wrote:

Hi Tom,

Looking at the request (and our logs), it looks like you’ve got a few
parameter names wrong, specifically “duration” (should be “hours”),
“client” (should be “contact”) and you don’t associate a timeslip directly
with a “project”, only with a “task” (which in turn is related to a
project). If you fix up the params you should be fine.

Let me know if this doesn’t help,

-J

Open Code Limited is a company registered at:
Well Cottage, 2 Blankstones Farm, 39 Acre End Street, Eynsham OX29 4PF.
Company nº 9301422 in England and Wales.

no worries, thought of a way of easing the delete pain, by writing a bit of
js in the console while viewing the timeslips page, which deleted all the
timeslips automatically :slight_smile:

I did come across this which might help automate
things https://www.mashape.com/freeagent/freeagentOn Tuesday, 30 December 2014 10:14:44 UTC, Jonathan Barrett wrote:

Hi Tom,

Sorry to say the API doesn’t currently support generic bulk operations,
only the few special cases listed in the documentation. You should be able
to issue a GET, find the affected slips and (as you suggest) merge with
your original source JSON to craft some updates, but each of these will
have to be issued individually as a PUT against the appropriate slip’s URL.

Alternatively, you could delete each affected slip and re-issue the
(fixed) bulk create request, but each DELETE would also have to be issued
individually.

Hope this helps a bit!

-J

On Tue, Dec 30, 2014 at 10:02 AM, waako <t…@opencode.limited <javascript:>> wrote:

Now I just have to clean up my mess!
Is there a way of bulk deleting timeslips so I can properly import them
all from scratch?

Alternatively I guess I could do a get and then merge that output with
the initial json which has hours value, and hope that I can put the updated
timeslips, but from documentation not sure if it is possible to bulk
put/update timeslips.

Many thanks!


Open Code Limited is a company registered at:
Well Cottage, 2 Blankstones Farm, 39 Acre End Street, Eynsham OX29 4PF.
Company nº 9301422 in England and Wales.


You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to freeagent_ap...@googlegroups.com <javascript:>.
To post to this group, send email to freeag...@googlegroups.com
<javascript:>.
Visit this group at http://groups.google.com/group/freeagent_api.
For more options, visit https://groups.google.com/d/optout.

Jonathan Barrett, Senior Engineer

FreeAgent: Accounting software, simplified
www.freeagent.com

+44 (0)131 447 0011

Follow us on Twitter: @freeagent https://twitter.com/freeagent

FreeAgent Central Ltd, 40 Torphichen Street, Edinburgh EH3 8JB
Registered in Scotland SC316774

Open Code Limited is a company registered at:
Well Cottage, 2 Blankstones Farm, 39 Acre End Street, Eynsham OX29 4PF.
Company nº 9301422 in England and Wales.

doh! thanks Jonathan, I was obviously staring at 2000 lines of JSON for
much too long.
Regex and Find/Replace only goes so far, good eyesight is needed for the
rest!

Let me start with all that and see if all goes well.

TomOn Monday, 29 December 2014 18:40:38 UTC, Jonathan Barrett wrote:

Hi Tom,

Looking at the request (and our logs), it looks like you’ve got a few
parameter names wrong, specifically “duration” (should be “hours”),
“client” (should be “contact”) and you don’t associate a timeslip directly
with a “project”, only with a “task” (which in turn is related to a
project). If you fix up the params you should be fine.

Let me know if this doesn’t help,

-J

Open Code Limited is a company registered at:
Well Cottage, 2 Blankstones Farm, 39 Acre End Street, Eynsham OX29 4PF.
Company nº 9301422 in England and Wales.