postnl customer API connector improvements - randomcrap - random crap programs of varying quality
 (HTM) git clone git://git.codemadness.org/randomcrap
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit e0c244551fc67c2c5d4f367e5f2c66dafb28d685
 (DIR) parent cf5826d1eac490fbfc30c3750773523f5da7548d
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Sat, 27 May 2023 10:05:55 +0200
       
       postnl customer API connector improvements
       
       * Set language parameter, it is now required.
       * Set curl options: -f and -s, status handling and silent about progress etc.
       * Just output JSON and don't use json2tsv directly.
       
       Diffstat:
         M postnl.sh                           |       9 +++++----
       
       1 file changed, 5 insertions(+), 4 deletions(-)
       ---
 (DIR) diff --git a/postnl.sh b/postnl.sh
       @@ -17,17 +17,18 @@ usage() {
        tracecode="$1"
        zipcode="$2"
        country="NL"
       +lang="nl" # ... or en
        
        test x"${tracecode}" = x"" && usage "$0"
        test x"${zipcode}" = x"" && usage "$0"
        test x"${country}" = x"" && usage "$0"
        
       -#url="https://jouw.postnl.nl/web/api/default/shipmentStatus/${tracecode}-${country}-${zipcode}"
       -url="https://jouw.postnl.nl/track-and-trace/api/trackAndTrace/${tracecode}-${country}-${zipcode}"
       +url="https://jouw.postnl.nl/track-and-trace/api/trackAndTrace/${tracecode}-${country}-${zipcode}?language=${lang}"
        
        curl \
                -m 10 \
       +        -f \
       +        -s \
                -L --max-redirs 0 \
                -H 'User-Agent:' \
       -        "$url" | \
       -        json2tsv
       +        "$url"