The approach you took is wrong or at least inappropriate IMO.
WLED already has /update HTTP endpoint where you can start the update using curl
or similar.
If you want WLED to “request” an update (as a response to API call, i.e. JSON) you may want to look into ESP8266httpUpdate class (or ESP32 variant).
You may best pair this with a usermod implementation.