However, I did get this working, the following snippet is from a bash script. Pass in the PROJECT and RETENTION and the older jobs will be deleted. I'm purging based on number of executions rather than by number of days - for my purpose this will suffice.
echo "Executing purge_job_history for project ${PROJECT} retention ${RETENTION}"
date
purged=0
URL="http://${NODE}:4440/api/2/project/${PROJECT}/jobs"
CURL_OUT=$(mktemp "/tmp/curl.out.XXXXX")
curl -H "X-RunDeck-Auth-Token:$TOKEN" -o $CURL_OUT -H "Content-Type: application/xml" -X POST "$URL" >/dev/null 2>&1
for JOB in $(xmlstarlet sel -t -m "/result/jobs/job" -m "@id" -v . -n ${CURL_OUT})
do
# For each job get the oldest executions
URL="http://${NODE}:4440/api/1/job/${JOB}/executions?offset=${RETENTION}"
curl -H "X-RunDeck-Auth-Token:$TOKEN" -o $CURL_OUT -H "Content-Type: application/xml" -X GET "$URL" >/dev/null 2>&1
for ID in $(xmlstarlet sel -t -m "/result/executions/execution" -m "@id" -v . -n ${CURL_OUT})
do
echo $ID
URL="http://${NODE}:4440/api/12/executions/delete?ids=${ID}"
curl -H "X-RunDeck-Auth-Token:$TOKEN" -o $CURL_OUT -X POST "$URL" >/dev/null 2>&1
purged=$((purged+1))
done
done
echo "Job executions purged: $purged"