Beginners guide to Lifx HTTP API

I have been browsing all day to get started with the HTTP api, can some one give me some pointers.
I am totally new to Rest API’s world

Note: I am looking to access my lifx bulbs over internet.

Any help much, appreciated.

Thank you,
Akul

Samples for Python are in the documentation.
You should start with Google as you would with any question you have.

For example from the set state documentation you have cURL, PHP and Python examples.

Thank you for the reply.

I am trying to generate the APP Token from cloud.lifx.com, but the website just wont authenticate me. I can control the bulbs using the app. but unable to login to cloud.lifx.com.

How are the token we generate tied to our bulbs ?

You login to the LIFX Cloud using the credentials that you use to login to the LIFX application. The bulbs that have been claimed to that account inside the application will be tied to all tokens created using that account.

thank you Daniel. (I am able to login now. )
let me understand the process of gaining the control of my bulb.

I have one query regarding how do I register my bulbs with my token.

  1. I have connected two bulbs in my local lan to my wifi router. I am connected to the same wifi router (In the same LAN as my bulbs)
  2. I am able to discover the two bulbs through the ios app.
  3. But I am able to claim only 1 out of those two bulbs through the app.
  4. After claiming 1 bulb I am trying to run the cUrl command to access the bulbs over the same network.
  5. I am not getting anything back.

  1. I have generated the token before claiming the bulb.

Is there anything wrong , I am doing.

Regards,
Akul Kapoor

It all sounds good, but there are a few caveats you might be hitting.

  1. Make sure you are signed into the same cloud account as the iOS/Android app when you generate the API token.
  2. Bulbs can only be claimed to a single account at a time. If you want to claim a claimed bulb to another account you will need to reset the bulb or delete it from the account that had it claimed.
  3. The order of the token creation and claiming doesn’t matter. You can create the token first or claim the bulb first, either will work.
  4. In the edit screen for the bulb it will list its cloud status. If the status is not connected, because there is a firewall or other issue, the bulb may not show up in the results, or it may show up as offline.

Hello Daniel,

My bulbs are behind the firewall.
How can i know what ports/protocol and IP address to allow through the firewall.
Below is the wireshark capture. Two bulbs( 192.168.1.4) & (192.168.1.3) are connected in the LAN to an access point. The access point is connected to the internet through a firewall.

is there a use case, i can refer to connect bulbs over the WAN/Internet/Cloud ?

The LIFX bulbs need to talk to the following services to gain access to the LIFX Cloud:

What do you mean by ‘Is there a use case’?

Thank you Daniel for the information. I should allow the above mentioned ports and IP through my network.

By use case i meant…the workflow diagram(like we have in the LAN api docs) . Sorry for the confusion. I think I should be good now.

By the information you gave, the Lifx messages are exchanged between bulbs and v2.broker.lifx.co on tcp port 56700.

Thank you again, I will initiate the required network changes to get my script working.
I will post if i come across any hurdle.