I\'m attempting to pull in data from an API using curl, and have the majority of the script done, but need some assistance. The API has results in multiple pages I need to retri
Take the end test out of the for
header, and test for it inside the loop. You can then use break
to end the loop.
for ((i=1; ; i++)); do
contents=$(curl -H "Authorization: Token insertlongtokenhere" -H "Content-Type: application/json" https://api.app.secunia.com/api/tickets/?page=$i)
echo "$contents"
if [[ $contents =~ 'next":null' ]]
then break
fi
done