Is my pin on?

I am very new to this so apologies if this is a stupid question.

I am writing an app which switches a device on and off, for now it’s just an LED. I have this working. My app basically calls a web url which controls the LED. All good. I want to be able to check if the LED is on or off though (say it was left on or maybe the user switched it on via a button). How do I go about doing this? I guess I basically want to call an url which asks the agent if a pin is active then replies with a “1” or “0”.

Any help most appreciated. An example of this would be great. Actually, what exactly I need to search for would be great :wink:

You just want to read the state of the pin, instead of writing it. For example, do a Checking the state will be very similar to actually turning on the LED. You send a request for the status of the pin, read it, and then reply back with a response.