You have three UI options for logging into your Raspberry Pi:
1. The “standard” way: connect a USB keyboard and HDMI monitor directly to the Pi.
2. connect a PC or Mac to the Pi by plugging a USB-to-serial console cable like the Adafruit 954 into the Pi’s GPIO header, and use the Terminal app on your laptop to connect and login to the Pi as described here.
3. connect your Pi to your local network and then use the SSH app on your Mac to open a remote session on the Pi as described here.
I use all three methods, and each has its benefits in different situations.
Once I’ve initially setup my Pi for networking using option 1 or 2, I find the third option – connecting via LAN – most flexible, since it doesn’t require the Pi to be tethered to my Mac or any other equipment. I can power up the Pi on my workbench, and as soon as it’s connected itself to the WiFi, I can SSH into it from anywhere in the house. Or even over the Internet if I open a port in my router for the purpose.
One of the most useful reasons for providing your Raspberry Pi with a REST API is to expose its input and output ports via the Internet for remote monitoring and control. This will allow you to control your RPi’s inputs and outputs from the browser on any smartphone or PC wherever you are in the world.
So now we will do just this, extending our REST API implementation from part 1 to read and display digital input ports.