# DevicesResource

Canonical page: https://docs.ovok.com/java-sdk/reference/devices-resource

```java
public final class DevicesResource
```

Manages Slim devices, their live rows and telemetry. Get it from [`SlimResource.devices()`](/java-sdk/reference/slim-resource#devices).

## Methods [#methods]

### list [#list]

```java
public Page<JsonNode> list(
        Map<String, ?> query,
        RequestOptions options) throws IOException, InterruptedException
```

Lists devices (`GET /v1/slim/device`).

**Parameters:**

- `query`: query parameters, sent as given
- `options`: per-request options, such as the timeout

**Returns:** the first page; iterating it loads the next pages

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### retrieve [#retrieve]

```java
public JsonNode retrieve(
        String deviceId,
        RequestOptions options) throws IOException, InterruptedException
```

Reads one device (`GET /v1/slim/device/{deviceId}`).

**Parameters:**

- `deviceId`: the device ID
- `options`: per-request options, such as the timeout

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### create [#create]

```java
public JsonNode create(Object body, RequestOptions options) throws IOException, InterruptedException
```

Creates a device (`POST /v1/slim/device`).

**Parameters:**

- `body`: the device to create
- `options`: per-request options, such as the timeout

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### update [#update]

```java
public JsonNode update(
        String deviceId,
        Object body,
        RequestOptions options) throws IOException, InterruptedException
```

Replaces a device (`PUT /v1/slim/device/{deviceId}`).

**Parameters:**

- `deviceId`: the device ID
- `body`: the updated device
- `options`: per-request options, such as the timeout

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### delete [#delete]

```java
public void delete(String deviceId, RequestOptions options) throws IOException, InterruptedException
```

Deletes a device (`DELETE /v1/slim/device/{deviceId}`).

**Parameters:**

- `deviceId`: the device ID
- `options`: per-request options, such as the timeout

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### assignToProject [#assigntoproject]

```java
public JsonNode assignToProject(
        Object body,
        RequestOptions options) throws IOException, InterruptedException
```

Assigns devices to a project (`PUT /v1/slim/device/assign/project`).

**Parameters:**

- `body`: the assignment request
- `options`: per-request options, such as the timeout

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### live [#live]

```java
public Page<JsonNode> live(
        Map<String, ?> query,
        RequestOptions options) throws IOException, InterruptedException
```

Lists devices with their live state (`GET /v1/slim/device/live`).

**Parameters:**

- `query`: query parameters; `count` must be an integer from 1 to 100
- `options`: per-request options, such as the timeout

**Returns:** the first page; iterating it loads the next pages

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response
- [`OvokValidationException`](/java-sdk/reference/ovok-validation-exception): if `count` is out of range

### liveTelemetry [#livetelemetry]

```java
public JsonNode liveTelemetry(
        Map<String, ?> query,
        RequestOptions options) throws IOException, InterruptedException
```

Reads live telemetry keyed by device (`GET /v1/slim/device/live/telemetry`).

**Parameters:**

- `query`: query parameters; `count` must be an integer from 1 to 100
- `options`: per-request options, such as the timeout

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response
- [`OvokValidationException`](/java-sdk/reference/ovok-validation-exception): if `count` is out of range

### telemetry [#telemetry]

```java
public JsonNode telemetry(
        String deviceId,
        RequestOptions options) throws IOException, InterruptedException
```

Reads one device's latest telemetry (`GET /v1/slim/telemetry/{deviceId}`).

**Parameters:**

- `deviceId`: the device ID
- `options`: per-request options, such as the timeout

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### effectiveObservationIds [#effectiveobservationids]

```java
public JsonNode effectiveObservationIds(
        String deviceId,
        RequestOptions options) throws IOException, InterruptedException
```

Reads one device's effective observation IDs (`GET /v1/slim/telemetry/{deviceId}/effectiveIds`).

**Parameters:**

- `deviceId`: the device ID
- `options`: per-request options, such as the timeout

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### effectiveObservationIdsByDevice [#effectiveobservationidsbydevice]

```java
public JsonNode effectiveObservationIdsByDevice(
        RequestOptions options) throws IOException, InterruptedException
```

Reads effective observation IDs for every device (`GET /v1/slim/telemetry/effectiveIds`).

**Parameters:**

- `options`: per-request options, such as the timeout

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### lastObservationIds [#lastobservationids]

```java
public JsonNode lastObservationIds(
        String deviceId,
        RequestOptions options) throws IOException, InterruptedException
```

Reads one device's last observation IDs (`GET /v1/slim/telemetry/{deviceId}/lastIds`).

**Parameters:**

- `deviceId`: the device ID
- `options`: per-request options, such as the timeout

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### lastObservationIdsByDevice [#lastobservationidsbydevice]

```java
public JsonNode lastObservationIdsByDevice(
        RequestOptions options) throws IOException, InterruptedException
```

Reads last observation IDs for every device (`GET /v1/slim/telemetry/lastIds`).

**Parameters:**

- `options`: per-request options, such as the timeout

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response
