I got it, this is in bash, using curl and the Rundeck API and paging.
rundeckURL="
https://rundeck/api/41"
rdheaders="X-Rundeck-Auth-Token: $token"
all_executions="[]"
limit=100
offset=0
total=0
succeeded=0
pcSucceeded=0
while :; do
url="$rundeckURL/job/$UUID/executions?max=$limit&offset=$offset"
# Fetch the page
response=$(curl -s -H "$rdheaders" -H "Accept: application/json" "$url")
# Get execution count using jq
count=$(echo "$response" | jq '.executions | length')
# Append executions to accumulator
if (( count > 0 )); then
# Merge into all_executions
all_executions=$(jq -s '.[0] + .[1]' <(echo "$all_executions") <(echo "$response" | jq '.executions'))
# Advance offset
offset=$((offset + limit))
else
break
fi
# Be gentle to API
sleep 0.2
done
total=$(echo "$all_executions" | jq 'length')
succeeded=$(echo "$all_executions" | jq '[.[] | select(.status=="succeeded")] | length')
if [ "$total" -gt 0 ]; then
pcSucceeded=$(( 100 * succeeded / total ))
fi
# $total is the total amount of executions of job $UUID
#
$pcSucceeded is the % of the total that have a status of "succeeded"
echo " $JNAME $total $pcSucceeded"