Skip to content

Instantly share code, notes, and snippets.

@Rican7
Created November 18, 2015 06:20
Show Gist options
  • Save Rican7/b585cde09fa0efe2820c to your computer and use it in GitHub Desktop.
Save Rican7/b585cde09fa0efe2820c to your computer and use it in GitHub Desktop.
Perform a cURL variable path request in a loop
#!/usr/bin/env bash
readonly ACCESS_TOKEN=""
readonly IDS=(
1
2
3
)
for id in ${IDS[@]};
do
echo -e "Doing work '${id}'... \c"
curl --silent --fail -o /dev/null \
-X POST \
-H "Authorization: Token ${ACCESS_TOKEN}" \
"https://api.example.com/resource/${id}/meta"
echo "Done."
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment