Skip to content

Instantly share code, notes, and snippets.

@haideralipunjabi
Created September 19, 2022 12:07
Show Gist options
  • Save haideralipunjabi/c69eb2b2c2ed1c57f054991081b0c2af to your computer and use it in GitHub Desktop.
Save haideralipunjabi/c69eb2b2c2ed1c57f054991081b0c2af to your computer and use it in GitHub Desktop.
Small Script to fetch details from Wakatime API
#!/bin/sh
API_KEY="<API-KEY>"
ENCODED_KEY=`echo $API_KEY | base64`
HEADER="Authorization: Basic $ENCODED_KEY"
TODAY=`date +%Y-%m-%d`
YESTERDAY=`date -d "yesterday" +%Y-%m-%d`
URL="https://wakatime.com/api/v1/users/current/summaries?start=$YESTERDAY&end=$TODAY"
echo $(curl -s -X GET -H "$HEADER" "$URL" | jq -r '.cummulative_total.digital')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment