Skip to main content

RoomService

A list of all methods in the RoomService service. Click on the method name to view detailed information about that method.

MethodsDescription
getRoomsList all available rooms
createRoomCreate a new room
getRoomGet details of a single room from its given {roomId}
updateRoomUpdate a single room from its given {roomId}
deleteRoomDelete a single room from its given {roomId}

getRooms

List all available rooms

  • HTTP Method: GET
  • Endpoint: /clip/v2/resource/room

Return Type

GetRoomsOkResponse

Example Usage Code Snippet

import { OpenHue } from 'open-hue';

(async () => {
const openHue = new OpenHue({
apiKey: 'YOUR_API_KEY',
});

const { data } = await openHue.room.getRooms();

console.log(data);
})();

createRoom

Create a new room

  • HTTP Method: POST
  • Endpoint: /clip/v2/resource/room

Parameters

NameTypeRequiredDescription
bodyRoomPutThe request body.

Return Type

CreateRoomOkResponse

Example Usage Code Snippet

import { OpenHue, ResourceIdentifier, RoomPut } from 'open-hue';

(async () => {
const openHue = new OpenHue({
apiKey: 'YOUR_API_KEY',
});

const rtype = Rtype.device;

const resourceIdentifier: ResourceIdentifier = {
rid: '42edd1f5-9538-4180-9ced-2d9e07f26d0f',
rtype: rtype,
};

const roomArchetype = RoomArchetype.living_room;

const roomPutMetadata: RoomPutMetadata = {
name: 'name',
archetype: roomArchetype,
};

const input: RoomPut = {
type_: 'type',
children: [resourceIdentifier],
metadata: roomPutMetadata,
};

const { data } = await openHue.room.createRoom(input);

console.log(data);
})();

getRoom

Get details of a single room from its given {roomId}

  • HTTP Method: GET
  • Endpoint: /clip/v2/resource/room/{roomId}

Parameters

NameTypeRequiredDescription
roomIdstringID of the room

Return Type

GetRoomOkResponse

Example Usage Code Snippet

import { OpenHue } from 'open-hue';

(async () => {
const openHue = new OpenHue({
apiKey: 'YOUR_API_KEY',
});

const { data } = await openHue.room.getRoom('roomId');

console.log(data);
})();

updateRoom

Update a single room from its given {roomId}

  • HTTP Method: PUT
  • Endpoint: /clip/v2/resource/room/{roomId}

Parameters

NameTypeRequiredDescription
bodyRoomPutThe request body.
roomIdstringID of the room

Return Type

UpdateRoomOkResponse

Example Usage Code Snippet

import { OpenHue, ResourceIdentifier, RoomPut } from 'open-hue';

(async () => {
const openHue = new OpenHue({
apiKey: 'YOUR_API_KEY',
});

const rtype = Rtype.device;

const resourceIdentifier: ResourceIdentifier = {
rid: '42edd1f5-9538-4180-9ced-2d9e07f26d0f',
rtype: rtype,
};

const roomArchetype = RoomArchetype.living_room;

const roomPutMetadata: RoomPutMetadata = {
name: 'name',
archetype: roomArchetype,
};

const input: RoomPut = {
type_: 'type',
children: [resourceIdentifier],
metadata: roomPutMetadata,
};

const { data } = await openHue.room.updateRoom('roomId', input);

console.log(data);
})();

deleteRoom

Delete a single room from its given {roomId}

  • HTTP Method: DELETE
  • Endpoint: /clip/v2/resource/room/{roomId}

Parameters

NameTypeRequiredDescription
roomIdstringID of the room

Return Type

DeleteRoomOkResponse

Example Usage Code Snippet

import { OpenHue } from 'open-hue';

(async () => {
const openHue = new OpenHue({
apiKey: 'YOUR_API_KEY',
});

const { data } = await openHue.room.deleteRoom('roomId');

console.log(data);
})();

Build Your Own SDKs with  liblab

Build developer friendly SDKs in minutes from your APIs

Start for Free →