Context
Being able to get package delivery status is possible, and there is a dedicated Docker image fo this. This post explain how to do this within a very few lines of code so you can integrate that into your ERP, develop mobile app or simply develop any integration.
Code snippet
sudo docker run --net=host -d -p 8080:8080 rastadidi/colisnc-api:latest
sudo apt-get install httpie jq boxes toilet
http http://localhost:8080/colis/CA107308006SI/latest
http http://localhost:8080/colis/CA107308006SI
# Shell: now the fun part
cat << EOF > colis.sh
#!/bin/bash
curl -sS http://localhost:8080/colis/\$1/latest | jq -r '.status' | boxes -d boy | toilet --gay -f term
EOF
chmod u+x colis.sh
./colis.sh CA107308006SI
cowsay -f tux That\'s all folks
Outputs
Finally json output for the latest known status of the delivery process:
{
"country": {
"code": "NC",
"iso": "NCL",
"name": "nouvelle-caledonie"
},
"date": "2019-09-09T09:41:13",
"informations": "",
"itemId": "CA107308006SI",
"localisation": "NOUMEA CDC",
"localization": {
"longName": "Office des Postes - Agence Principale",
"name": "NOUMEA CDC",
"url": "https://goo.gl/maps/verSQbb6tQaqzKq87"
},
"pays": "NOUVELLE-CALÉDONIE",
"rawDateHeure": "09/09/2019 09:41:13",
"status": "COLIS_LIVRE",
"typeEvenement": "Votre courrier/colis a été livré"
}
Resources
- Original Web Front-end I scrap to get the core data
- Refactored website, relying on the API and other APIs with Google authentication and Maps
- Mobile app demo (with native cloud services like IFTTT, messenger, ...)
- Mobile app on Google Play Store
- Augmented Reality (AR) experiment that relies on the API
- API on RapidAPI Marketplace
- KataCoda Scenario showing how to deploy the API on Kubernetes Cluster
Full demo
Find below the full video demo, from scratch, with system install thanks to Vagrant: