button on the bridge. At this point, the iOS app instructs the user to do so, as shown in
Figure 1-9.
FIGURE 1-9. iOS app instructing the user to press the physical button on the bridge
Behind the scenes, the iOS app sends the following POST request to the bridge:
POST /api HTTP/1.1
Host: 10.0.1.2
Proxy-Connection: keep-alive
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Accept-Language: en-us
Accept: */*
Pragma: no-cache
Connection: keep-alive
User-Agent: hue/1.1.1 CFNetwork/609.1.4 Darwin/13.0.0
Content-Length: 71
{"username":"[username DELETED]","devicetype":"iPhone 5"}
Note that the value of the username field sent here is the same as the one sent in the previ-
ous request, which failed because the iOS app was running for the first time on the particular
device. If the user presses the button on the bridge within 30 seconds, this particular username
will become authorized and can be used to issue commands to the bridge while on the local
network.
CONTROLLING LIGHTS USING THE IOS APP 17