View bulk-add.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Usage: | |
// time CL_TOKEN="token from https://new.costlocker.com/api-token" php bulk-add.php | |
// 0) configuration | |
$config = [ | |
'costlocker' => [ | |
'url' => 'https://new.costlocker.com/api-public', | |
'token' => getenv('CL_TOKEN') ?: 'token from https://new.costlocker.com/api-token', | |
], |
View signature.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$secret = 'bceefe12-78e6-49b8-d339-88b8b635b4fe'; | |
$body = '{"meta":{"events":{"projects.create":1,"peoplecosts.change":1}},"links":{"webhook":{"webhook":"http:\/\/costlocker.php5:8080\/api-public\/v2\/webhooks\/162edc70-8f33-41ec-8d78-69ed1a21aca1","example":"http:\/\/costlocker.php5:8080\/api-public\/v2\/webhooks\/162edc70-8f33-41ec-8d78-69ed1a21aca1\/test"}},"data":[{"event":"projects.create","data":[{"id":1,"name":"Website","state":"running","client":{"id":1,"name":"ACME"},"dates":{"date_start":"2017-06-26","date_end":"2017-07-26"},"project_id":{"id":null,"is_generated":false},"tags":[{"name":"Billable"}],"responsible_people":[{"email":"john@example.com","first_name":"John","last_name":"Doe"}],"links":{"project":"http:\/\/costlocker.php5:8080\/api-public\/v2\/projects\/1","peoplecosts":"http:\/\/costlocker.php5:8080\/api-public\/v2\/projects\/1?types=peoplecosts","billing":"http:\/\/costlocker.php5:8080\/api-public\/v2\/projects\/1?types=billing","expenses":"http:\/\/costlocker.php5:8080\/api-public |
View .env
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CL_HOST="" | |
CL_CLIENT_ID="" | |
CL_CLIENT_SECRET="" |
View create-webhooks.bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# init environment variables | |
CL_AUTH="webhooks_test:YOUR_PERSONAL_TOKEN" | |
CL_API="https://new.costlocker.com/api-public/v2" | |
# create webhook | |
curl -X POST -u $CL_AUTH "$CL_API/webhooks" -d @webhooks-request.json | |
# test webhook | |
CL_WEBHOOK="UUID_OF_EXISTING_WEBHOOK" | |
curl -X GET -u $CL_AUTH "$CL_API/webhooks/$CL_WEBHOOK/test" |
View import-toggl-weekly-report.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$config = [ | |
'costlocker' => [ | |
'url' => 'https://new.costlocker.com/api-public/v2/timeentries/', | |
'token' => 'COSTLOCKER_TOKEN', | |
], | |
'toggl' => [ | |
'url' => 'https://toggl.com/reports/api/v2/weekly', | |
'token' => 'TOGGL_TOKEN', |