Skip to content

Instantly share code, notes, and snippets.

@mfilenko
Last active March 12, 2024 17:17
Show Gist options
  • Save mfilenko/ed46084530fdb02002c7d62e57b079c6 to your computer and use it in GitHub Desktop.
Save mfilenko/ed46084530fdb02002c7d62e57b079c6 to your computer and use it in GitHub Desktop.
Automate Working Hours on Deel
DEEL_API_TOKEN="your-token"
DEEL_CONTRACT_ID="your-contract-id"
START_DATE="2024-03-01"
while [ "$START_DATE" != $(date +%Y-%m-%d) ]; do
if [ $(date -f "%Y-%m-%d" -j "$current_date" "+%u") -lt 6 ]; then # only weekdays
curl -X POST \
-H "Content-Type: application/json" \
-H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:122.0) Gecko/20100101 Firefox/122.0" \
-H "x-app-host: app.deel.com" \
-H "x-auth-token: $DEEL_API_TOKEN" \
-H "x-api-version: 2" \
-d "{\"contractOid\":\"$DEEL_CONTRACT_ID\",\"start\":\"${START_DATE}T09:00:00.000Z\",\"end\":\"${START_DATE}T17:30:00.000Z\",\"description\":\"\",\"breaks\":[{\"start\":\"${START_DATE}T12:00:00.000Z\",\"end\":\"${START_DATE}T12:30:00.000Z\"}]}" \
https://api.deel.com/time_tracking/time_sheets/shifts
fi
START_DATE=$(date -v +1d -jf "%Y-%m-%d" "$START_DATE" "+%Y-%m-%d")
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment