Change modes via REST API?

Create an “On/Off Button Tile” device (My Devices > New Device). Fill out the following -

Device Settings

You can use whatever you want for the Device Network Id.

Then create a new smartapp with the code provided below. The switch to monitor will be the new On/Off button tile switch you just created. It subscribes to the ‘on’ event and in the case of the code below will change to Night mode unless already in Night mode.

/**
 *  Night Mode Toggle
 *
 *  code borrowed from @stevesell
 *
 *  Date: 2014-04-17
 */
preferences {
	section("Select Switch to monitor"){
		input "theSwitch", "capability.switch"
	}
}

def installed() {
	log.debug "Installed with settings: ${settings}"
    initialize()
}

def updated(settings) {
	log.debug "Updated with settings: ${settings}"
	unsubscribe()
    initialize()
}

def onHandler(evt) {
	log.debug "Received on from ${theSwitch}"
    if(location.mode != "Night") {
        setLocationMode("Night")
    } else {
    	log.debug "Already Night - ignoring"
    }
    theSwitch.off()
}

def offHandler(evt) {
	log.debug "Received off from ${theSwitch}"
}

def initialize() {
	subscribe(theSwitch, "switch.On", onHandler)
    subscribe(theSwitch, "switch.Off", offHandler)
}