jq now gets upset if passed an empty argument (which is, in fact, distinct to not being passed an argument\!)
This commit is contained in:
parent
07950c0be7
commit
e9ed7b3e11
2
api.sh
2
api.sh
|
@ -1,7 +1,7 @@
|
||||||
baseurl(){ if [ -z $INSEC ]; then sec=s; fi; echo "http$sec://$INSTANCE/api/v3/"; } # This needs to be a function so updates to INSTANCE affect it. This is a very old bug lmao
|
baseurl(){ if [ -z $INSEC ]; then sec=s; fi; echo "http$sec://$INSTANCE/api/v3/"; } # This needs to be a function so updates to INSTANCE affect it. This is a very old bug lmao
|
||||||
|
|
||||||
#Generics
|
#Generics
|
||||||
get(){ curl -s "$(baseurl)$1?${*:3}" | jq "$2"; }
|
get(){ curl -s "$(baseurl)$1?${*:3}" | jq "${2:-.}"; }
|
||||||
getauth(){ get "$1" "$2" "auth=$TOKE&${*:3}"; }
|
getauth(){ get "$1" "$2" "auth=$TOKE&${*:3}"; }
|
||||||
post(){ curl -s "$(baseurl)$1" --json "$(echo ${*:2} | jq '.+{"auth":"'$TOKE'"}')"; }
|
post(){ curl -s "$(baseurl)$1" --json "$(echo ${*:2} | jq '.+{"auth":"'$TOKE'"}')"; }
|
||||||
# I'm just gonna clone this thing rather than try to palm the -X PUT into post. I can fix it later.
|
# I'm just gonna clone this thing rather than try to palm the -X PUT into post. I can fix it later.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user