DevicesResource

Manages Slim devices, their live rows and telemetry.

  • Stable unknown
  • Release candidate since 0.1.0-rc.4
  • Development since 0.1.0-dev.24+fa54770
public final class DevicesResource

Manages Slim devices, their live rows and telemetry. Get it from SlimResource.devices().

Methods

list

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

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

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

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

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

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

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: if count is out of range

liveTelemetry

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: if count is out of range

telemetry

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

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

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

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

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

Last updated on

On this page