Pause resume folder using CLI

Ok now it is getting a bit weird. I am getting a “Decoding posted config: unexpected end of JSON input” error.

When I don’t execute the jq there is no error.

This is the code that I am using now. Not too different then the above.

set -euo pipefail

folder=$1
echo "resuming "$folder

st='http://localhost:8384/rest/system/config' 
key='myKey'

f=$(mktemp)
function clean {
  rm -f "$f"
}
trap clean EXIT

curl -s -H X-API-Key:$key $st > "$f" 
cat $f > orig.txt

#jq -r '(.folders[] | select(.label=='\"$folder\"')) .paused = false' "$f" > "$f"
jq -r '(.folders[] | select(.label=='\"$folder\"')) .paused = false' "$f" > output.txt

curl -s -H X-API-Key:$key --data-binary @"$f" $st

I run a diff on orig.txt and output.txt and the only change is the one I want; diff result

 <       "paused": true,
 ---
 >       "paused": false,