#!/bin/bash # Function to get the date code for a given package and version get_date_code() { package=${1:-"evolution"} version=${2:-"3.38.3-1+deb11u2"} # Construct the URL url="https://snapshot.debian.org/mr/package/${package}/${version}/binfiles/${package}/${version}" # Send a GET request to the API endpoint and parse the JSON response hash=$(curl -s "${url}" | jq -r '.result[0].hash') # Construct the URL for the /file//info endpoint info_url="https://snapshot.debian.org/mr/file/${hash}/info" # Send a GET request to the /file//info endpoint and parse the JSON response date_code=$(curl -s "${info_url}" | jq -r '.result[0].first_seen') echo "${date_code}" # Outputs: 20230504T173035Z } # Call the function #get_date_code "$@" get_date_code "$@"