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 retrieve, and I've been able to script that function, but I can't figure out how to make the loop stop. Also, I need some assistance in figuring out how to break each pages data up into individual events. Each event starts with the same string, so I know the text to use in order to break up the events, but I don't know the syntax for doing so. Can someone assist with that as well? My code is below:
#!/bin/sh
string='next\":null'
for ((i=1;until $string;i++)); do
curl -H "Authorization: Token insertlongtokenhere" -H "Content-Type: application/json" https://api.app.secunia.com/api/tickets/?page=$i
done
Using this string method gives me a
./secunia.sh: line 3: ((: until next\":null: syntax error: invalid arithmetic operator (error token is "\":null")
I've tried other ways of commenting out the double quotes to no avail, so I'm kind of stuck.
until $string?forloop and use thebreakstatement to stop the loop."last_updated":"2017-02-28T17:56:19Z"},{"id":588699,"name":null,and this is the sed line I'm tryingsed -e "s/},{/}+{/" -e "s/}[^}]*$/}/" secunia.txt | tr "+" "\n", and I've put it outside the for loop, but it's not pulling out the,. What am I missing?