ixudra / toggl

Custom PHP library to connect with the Toggl API - developed by Ixudra
MIT License
27 stars 18 forks source link

Toggl API #12

Closed drkapoor closed 5 years ago

drkapoor commented 5 years ago

Hi

I really need your help. I'm struggling with getting time entries on Toggl via API.

I am working on a Laravel based project and I need to import time entries from my Toggl account. I am not able to pull records via API for some reason. I have configured Ixudra/toggl library correctly as per the given instructions.

image

This class is working partially. Its dashboard() function is working however timeEntries() function is not working as per the expectation. It does not return any error and returning NULL on each request.

Please have a look into this and shed some light on this and let us know if this is a known issue and how should we resolve this?

Thanks, Deepak

elimentz commented 5 years ago

You should use the correct date format. As specified in the api documentation, the date should have ISO 8601 format. Try the following:

$entries = Toggl::timeEntries('2019-08-08T08:00:00+00:00', '2019-08-13T08:00:00+00:00');

Or probably a better way, if you're using carbon dates:

Toggl::timeEntries($startDate->toIso8601String(), $end->toIso8601String());

I should probably change that since carbon and/or string would be easier to work with. Something for the future :-)

drkapoor commented 5 years ago

Awesome, It resolves this issue, Thanks for the prompt reply. :)