Tied some command line processing tools together to build out a nice script automation one liner (a long line, but still works) to achieve the goal of zip up a set of files, submit to an API, read the response (JSON) and store that result into a unique runtime record log result
- Zip a file, but make sure it doesn't store the directory paths and wipes out the contents beforehand to make sure that the zip file target doesn't get polluted with unknown and unnecessary information
zip -jr - sample_files > sample_input.zip
-jRemove the directory information from the file
rRecursively pick up files
-Output to standard IO instead of file
target_folderin this case
>Pipe the output to the zip file
curl --location '
https://google-vr-calculator.district9.info/feed?external_id=rental1&start_date=2024-02-01&end_date=2024-02-08&booked_date=2023-10-21' --form 'upload_file=@"sample_input.zip"'
.Piped input to jq command to format
- Name of file plus date command into a format all from Years to seconds to get a unique to the second file name