• Share this text:
Report Abuse
Untitled - posted by guest on 19th December 2019 05:32:35 PM

echo 'Getting JWT'

JWT=$(curl -X POST -F 'client_id=arta.microservice' -F 'client_secret=NaQttHtXV2ZLbJvKU9s4' -F 'grant_type=client_credentials' -F 'scope=arta.api' http://arta_authentication_api:5001/connect/token | grep -o -E "\"access_token\":\".*\"+" | awk -F\: '{print $2}' | cut -c 2- | cut -d '"' -f1)

echo 'JWT: '$JWT

cat invoices.txt | while read line

do

 trimmedline=$(echo $line | tr -d '\n' | tr -d '\r')

 echo 'Generate pdf for invoice: '$trimmedline

 curl -X PUT -H "Content-Type: application/json" -d '{}' -H 'Accept: application/json' -H "Authorization: Bearer $JWT" "http://arta_invoices_engine:9000/engines/csps/csp/invoices/${trimmedline}/generatepdf" --verbose

done

echo 'Done!'

$SHELL

Report Abuse

Login or Register to edit or copy and save this text. It's free.