Hubitat api to get response out of Hubitat

Hi
is it possible to get the response out of habitat (something like if the door is open i want on the light but the light is connected with a serial port )

Can you please explain this a little more clearly?

If you just want a 'device' that sends a http network packet for 'on' and another for 'off', take a look at the Open Source HttpSwitch from the Hubitat Public GitHub Repository.

You could then have the computer with the serial attached switch listen for these packets and send the correct serial commands.

Or, you could use by HubDuino software if you want to serially connect your switch to an Arduino or ESP8266 microcontroller.