Skip to content
/ api-sync Public

An example application to sync Kimai timesheets to a local database

License

Notifications You must be signed in to change notification settings

kimai/api-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

May 31, 2024
55e7ab4 · May 31, 2024

History

4 Commits
May 31, 2024
May 31, 2024
May 31, 2024
May 31, 2024
May 31, 2024
May 31, 2024
May 31, 2024

Repository files navigation

Sync your Kimai data via API to a local database

Installation

  • Clone the repo: git clone git@github.com:kimai/api-sync.git kimai-api-sync
  • Create the database and then the necessary tables, structure can be found in database.sql
  • Execute php composer.phar install --optimize-autoloader -n
  • Edit configuration.php and adjust settings to your needs

Usage

The sync script can be run with php sync.php and it has two optional parameters:

  • --modified="2024-01-01 12:00:00" - only sync timesheets, which were changed after a certain date-time, format: YYYY-MM-DD HH:mm:SS
  • --timesheets - only sync timesheets

If --modified is skipped, only the latest 24 hours will be synced

Initial sync

For the initial sync you should choose a date far in the past, so all non-synced timesheets will be fetched:

php sync.php --modified="2020-12-31 00:00:00"

Cronjob

Now you can easily fetch latest changes via cronjob.

If you installed the project into /opt/kimai-api-sync/ and want to sync once a night you might want to use something like:

17 3 * * * /usr/bin/php /opt/kimai-api-sync/sync.php --modified="2020-12-31 00:00:00" --timesheets >> /var/log/kimai-api-sync.log 2>&1

About

An example application to sync Kimai timesheets to a local database

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages