The Philips Hue API

First, let’s perform a very simple command and get information about your Hue system. Fill in the details, leaving the body box empty, and press the GET button:

Address http://<bridge ip address>/api/newdeveloper
Body  
Method GET

You should see a response similar to what is shown in the following screenshot:

Now, this is the command to fetch all information in the bridge. You didn’t get much back, and that’s because you’re using an unauthorized username: newdeveloper.

We need to use the randomly generated username that the bridge creates for you. Fill in the following information and press the POST button:

 

Address http://<bridge ip address>/api
Body {"devicetype":"my_hue_app#iphone peter"}
Method POST

This command is basically asking you to create a new resource inside /api (where usernames sit) with the following properties.

When you press the POST button, you should get back an error message that lets you know that you have to press the link button in the application in order to test the device. This can help us to test the request and the app will control your lights. By pressing the button, we test whether the user has physical access to the bridge:

Go and press the button on the bridge and then press the POST button again and you should get a success response, as follows:

Congratulations, you’ve just created an authorized user (1028d66426293e821ecfd9ef1a0731df), which we’ll use from now on! Now if you perform the first GET command again, you should get a whole lot more information about what lights you have and their states. This data is all in the JSON format, so it can be easily processed by your applications.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.151.141