I figured it out. I was simply clicking on the link which obviously is an HTTP GET request. Trying this in Chrome DevTools | Console works fine (note the "PUT" method):
fetch('https://ezdata2.m5stack.com/api/v2/device/updateStamPlc/${device_id}/relay/0/true', {method: "PUT"})
.then(res => res.json())
.then(console.log)
Result:
{code: 200, msg: 'OK', data: 1}