export clt="..." # get from Profile > OAUTH > Personal Access Token

get all rules (check metadata to see if all fits in one page)

curl -H "Authorization: Bearer ${clt}" "https://fireflyiii.hs.tjenwellens.eu/api/v1/rules?limit=100" > rules.json

get the one rule you need

cat rules.json| jq '.data[] | select(.id == "54")|.attributes' > rules.54.continente-category.json
curl -v -X 'PUT' --data "@rules.54.continente-category.json" -H "content-type: application/json"  -H "Authorization: Bearer ${clt}" "https://fireflyiii.hs.tjenwellens.eu/api/v1/rules/54" | jq
cat rules.json| jq '.data[] | select(.id == "55")|.attributes + {  triggers: .attributes.triggers|map(if .type == "description_contains" then . + {value:.value|ascii_upcase} else . end)  }'

create file per rule with UPPERCASE trigger value

cat rules.json| jq '.data[] | {id} + .attributes + {  triggers: .attributes.triggers|map(if .type == "description_contains" then . + {value:.value|ascii_upcase} else . end)  } | "\(.id)\t\(.)"' -r | awk -F\\t '{ file="updates/"$1".json"; print $2 > file; close(file); }'

update all

 while read id; do; 
 
 echo "$id.json"; 
 curl -X 'PUT' --data "@${id}.json" -H "content-type: application/json"  -H "Authorization: Bearer ${clt}" "https://fireflyiii.hs.tjenwellens.eu/api/v1/rules/${id}"
 
 done <<< $(find . -type f | sed 's!^..\([0-9][0-9]*\).json!\1!')

trigger all rules in all groups

curl -H "Authorization: Bearer ${clt}" "https://fireflyiii.hs.tjenwellens.eu/api/v1/rule-groups" |jq '.data[]|select(.attributes.active==true)|.id' -r | xargs -I '{}' curl -X POST -H "content-type: application/json" -H "Authorization: Bearer ${clt}" "https://fireflyiii.hs.tjenwellens.eu/api/v1/rule-groups/{}/trigger" | jq