Skip to content

Instantly share code, notes, and snippets.

@elvisimprsntr
Created October 26, 2012 21:48
Show Gist options
  • Save elvisimprsntr/3961767 to your computer and use it in GitHub Desktop.
Save elvisimprsntr/3961767 to your computer and use it in GitHub Desktop.
Bash script for the REST interface of Thinkflood's RedEye
#!/bin/bash
read -p "Enter RedEye IP address or hostname: " REIP
# define variables
RESTURL=http://$REIP:8080/redeye
RESTLOG=redeye_interrogate.log
# define function
restwget () {
wget -O $RESPLOG.xml ${RESTURL}${RESTCMD} >> ${RESTLOG} 2>&1
}
echo "Begin RedEye REST interrogation" > ${RESTLOG} 2>&1
# Device
RESTCMD=/
RESPLOG=redeye_info
restwget
# Rooms
RESTCMD=/rooms/
RESPLOG=redeye_rooms
restwget
# Devices
RESTCMD=/rooms/0/devices/
RESPLOG=redeye_devices
restwget
# Commands
RESTCMD=/rooms/0/devices/2/commands/
RESPLOG=redeye_commands
restwget
# Send Command
RESTCMD=/rooms/0/devices/2/commands/send?commandId=14
RESPLOG=redeye_sendcommand
restwget
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment