This is the script I use to change site on the computer its run on.
#!/bin/bash
# Provided as it is, no guaranties, don't blame me if something breaks!
# ——————————— Changes Site ———————————
apiURL="https://domain.jamfcloud.com"
apiUser="user"
apiPass="password"
newSite="Sitename"
idSite="2"
# ——————————— Getting the serial ———————————
computerserial="$(system_profiler SPHardwareDataType | grep 'Serial Number (system)' | awk '{print $NF}')"
#Change the Site
echo "<computer><general><site><id>$idSite</id><name>$newSite</name></site></general></computer>" | curl -X PUT -fku $apiUser:$apiPass -d @- $apiURL/JSSResource/computers/serialnumber/$computerserial/subset/general -H "Content-Type: application/xml"