Playing with Hue and Postman is pretty simple. The first thing you need to do is generate a username token for API access. To do this first press the button on the Hue Bridge and within 30 seconds do a POST request to http://<bridge-ip>/api with a body of:
{
"devicetype": "postman"
}
This will generate a JSON response similar to:
[
{
"success": {
"username": "6BuAOXcL81Y6XeAae0crrFQHFIlFPdkq48qXo3Vp"
}
}
]
Going forward your URL endpoint will include the newly created username token for all API calls. For example to get light information do a GET request to http://<bridge-ip>/api/<username>/lights
To turn on a single light take note of the light id from the above JSON response and do a PUT request to the URL including the light id http://<bridge-ip>/api/<username>/lights/<id>/state. In the body set the state:
{
"on": true
}
Changing the above to “false” would turn the light off.
To turn on/off using groups get the group number by doing a GET request to http://<bridge-ip>/api/<username>/groups. Take the group number from the JSON output and do a PUT request to http://<bridge-ip>/api/<username>/groups/<group-number>/action. In the JSON body set the action:
{
"on":true
}
As before with the lights changing to “false” would turn all lights off in the group.
The reason I started playing with the API in the first place was to use the alert function to flash my lights which can be done with either a single light or a group by changing your JSON body to:
{
"alert":"lselect"
}
The above will flash the lights for 15 seconds. Changing to “select” will flash once.
There are a lot more options available and everything is documented on the Hue Developer website, but that will get you started.