Skip to main content

ZoneService

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

MethodsDescription
getZonesList all available zones
createZoneCreate a new zone
getZoneGet details of a single Zone from its given {zoneId}
updateZoneUpdate a single Zone from its given {zoneId}
deleteZoneDelete a single Zone from its given {zoneId}

getZones

List all available zones

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

Return Type

GetZonesOkResponse

Example Usage Code Snippet

import { OpenHue } from 'open-hue';

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

const { data } = await openHue.zone.getZones();

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

createZone

Create a new zone

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

Parameters

NameTypeRequiredDescription
bodyRoomPutThe request body.

Return Type

CreateZoneOkResponse

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.zone.createZone(input);

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

getZone

Get details of a single Zone from its given {zoneId}

  • HTTP Method: GET
  • Endpoint: /clip/v2/resource/zone/{zoneId}

Parameters

NameTypeRequiredDescription
zoneIdstringID of the Zone

Return Type

GetZoneOkResponse

Example Usage Code Snippet

import { OpenHue } from 'open-hue';

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

const { data } = await openHue.zone.getZone('zoneId');

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

updateZone

Update a single Zone from its given {zoneId}

  • HTTP Method: PUT
  • Endpoint: /clip/v2/resource/zone/{zoneId}

Parameters

NameTypeRequiredDescription
bodyRoomPutThe request body.
zoneIdstringID of the Zone

Return Type

UpdateZoneOkResponse

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.zone.updateZone('zoneId', input);

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

deleteZone

Delete a single Zone from its given {zoneId}

  • HTTP Method: DELETE
  • Endpoint: /clip/v2/resource/zone/{zoneId}

Parameters

NameTypeRequiredDescription
zoneIdstringID of the Zone

Return Type

DeleteZoneOkResponse

Example Usage Code Snippet

import { OpenHue } from 'open-hue';

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

const { data } = await openHue.zone.deleteZone('zoneId');

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

Build Your Own SDKs with  liblab

Build developer friendly SDKs in minutes from your APIs

Start for Free →