Add `v1/groups/all` endpoint to the HTTP API

I think i’m missing something, but I couldn’t find a way to query the HTTP API and pull back a list of groups. Right now I am grabbing all lights with /lights and looping through them to create an in-memory cache of groups. It’d be much easier to have an endpoint /groups which I could hit and grab all light IDs in that group.

2 Likes

I found a way around this using this syntax:

https://api.lifx.com/v1/lights/group:Living Room

I didn’t see it documented anywhere, but this is how I was able to pull all lights in a group very easily.

It is in the Selectors for the doco.

I added the link as a reference for anyone else who may be interested.

Thanks @boxhead! That’s a great resource for all the selector types :slight_smile:.

After my previous post yesterday, I thought about it and remembered, I’m still looking for a way to pull all the group names from a route similar to how you can for a scene. Completely forgot about exactly why I was wanting that endpoint, but now that I remember, it seems more important.

Right now I’m pulling all the lights and looping through each one to create all the groups. It would be a lot easier to just pull the list of groups w/ the corresponding light IDs similar to how you’d see them in scenes. At that point, I can do a lookup on those light IDs via the LAN protocol when I need them.

So you want a List Groups endpoint in addition to the List Lights one or a way to sort the data.
There is List Scenes and List Lights so yeah I agree List Groups would be a good addition.

Sorry I saw the headline as more of using the selector in List Lights to get a list of bulbs from within a specific group. But to know your group you need the ID and that only comes with a full list of lights.
Can you change the title of the post ? certainly to me this is a good suggestion to the developers.

Actually thinking about it this is a great example I can use for my Mulesoft training, create my own endpoints that does this for me

I would like a groups endpoint as well. Currently I run through all the lights and grab the groups and then output them.