Flipping a switch from remote rPI

I have 1 rPi running hassio, and I want to have several more running a custom GUI from which I can control my hassio.
So currently I’m trying to control 1 light from remote rPI with the REST API ( https://developers.home-assistant.io/docs/en/external_api_rest.html )
I’m able to get states, but I can’t “flip the switch”

import requests

url = "http://192.168.1.225:8123/api/states/switch.ghlinks"
headers = {
    "Authorization": "Bearer ABCDE",
    "content-type": "application/json",
}
myobj = '{"state": "on"}'

response = requests.post(url, headers=headers, data = myobj)

print(response.text)

the state is changed, but the light doesn’t come on (or off)
How do I do this?

API call should be to http://192.168.1.225:8123/api/services/light/turn_on then pass entity as data if this call is to HA endpoint.

EDIT
Or api/services/homeassistant/turn_on since it is switch not light

My Garage RPI Player just runs a mqtt pub (a poor single cmd nothing with python import json overkill) to tell his amp to shutoff or power on.
fast simple and bulletproof

Thanks for the help, and for future reference: the right code was
http://192.168.1.225:8123/api/services/switch/turn_off

import requests

url = "http://192.168.1.225:8123/api/services/switch/turn_off"
#url = "http://192.168.1.225:8123/api/states"
headers = {
    "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI3YTU1MzRhZWFiMmQ0MjE4YWIyNWMyY2U2MGUxMjQ3MiIsImlhdCI6MTU3OTY5eNDI5NywiZXhwIjoxODk1MDU0Mjk3fQ.uNYhEX9lg24H09UQLJtT7wQfcCwclG7POtrGGbEiqvc",
    "content-type": "application/json",
}
myobj = '{"entity_id": "switch.relais_3"}'

response = requests.post(url, headers=headers, data = myobj)
#response = requests.get(url, headers=headers)
print(response.text)