Skip to content

Instantly share code, notes, and snippets.

@Riebart
Created March 1, 2020 19:36
Show Gist options
  • Save Riebart/b98cdfaa9f5ac20f6c5093aed6d5923b to your computer and use it in GitHub Desktop.
Save Riebart/b98cdfaa9f5ac20f6c5093aed6d5923b to your computer and use it in GitHub Desktop.
Watch a fedex package status via API calls
#!/bin/bash
tracking_number="$1"
while [ true ]
do
date +%FT%T
echo -n "Tracking ${tracking_number} "
curl 'https://www.fedex.com/trackingCal/track' \
-s \
-H 'Connection: keep-alive' \
-H 'Pragma: no-cache' \
-H 'Cache-Control: no-cache' \
-H 'Accept: */*' \
-H 'X-Requested-With: XMLHttpRequest' \
-H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
-H 'Origin: https://www.fedex.com' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Accept-Language: en-US,en;q=0.9' \
--data "data=%7B%22TrackPackagesRequest%22%3A%7B%22appType%22%3A%22WTRK%22%2C%22appDeviceType%22%3A%22DESKTOP%22%2C%22supportHTML%22%3Atrue%2C%22supportCurrentLocation%22%3Atrue%2C%22uniqueKey%22%3A%22%22%2C%22processingParameters%22%3A%7B%7D%2C%22trackingInfoList%22%3A%5B%7B%22trackNumberInfo%22%3A%7B%22trackingNumber%22%3A%22${tracking_number}%22%2C%22trackingQualifier%22%3A%22%22%2C%22trackingCarrier%22%3A%22%22%7D%7D%5D%7D%7D&action=trackpackages&locale=en_CA&version=1&format=json" | \
jq '.TrackPackagesResponse.packageList | map(.statusWithDetails)'
sleep 60
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment