Managing Devices in an Account

Once an account is set up, it is assumed that you (or the customer you are integrating for) would want to manage the 4D Scale units (or devices) in use.

As soon as a 4D Scale unit is set up and connected to the Internet, it broadcasts its presence to the cloud. Because at this point the device is not associated with any account, it is treated as being public.

Any public device can be added to an account at which point it can be thought of as a private one.

Any device in an account can be removed which causes it to be treated as public again.

Fetch list of “public” devices

Fetch a list of public devices by calling GET /devices/public

This list includes all devices that have been registered with the 4D Scale cloud but are not associated with any account. The device information includes serial number.

The resulting Device objects contain information such as:

  • Whether or not the device is currently connected to the cloud
  • When it was “first seen” (registered with the cloud) and “last seen” (last connected to the cloud), in UTC timestamps

Each device contains DeviceMeta information such as:

  • The serial number of the unit (which can be used to add the device to an account)

Fetch list of “private” devices (devices associated with an account)

Fetch a list of devices associated with a given account by calling GET /accounts/devices

Add device to account

Add a device (identified by its serial number) to an account by calling

POST /accounts/devices/{serialNumber}

If the serial number corresponds to a device that is currently associated with another account, the operation will fail.

Remove device from account

Remove a device (identified by its serial number) from an account by calling

DELETE /accounts/devices/{serialNumber}

If the serial number corresponds to a device that is currently associated with another account, the operation will fail. Similarly, the operation will fail if the device is currently with public status.

Make a device private or public (read-only)

Once a device is added to your own account, the device can only be controlled if the request is authorized with an ApiKey.

However, for the purpose of ease access to non-identifying data, you may access measurements using a short link like https://r.4dscale.com/d/{serialNumber} without requiring log in. The same link (QR code) is displayed on the 4D Scale display.

If you would like to completely block-off public read-only access to your device and its measurements, you can call

DELETE /devices/{serialNumber}/options/exposed?machineId={machineId}

Similarly, if you would like to allow public read-only access, you can call

PUT /devices/{serialNumber}/options/exposed?machineId={machineId}

The machineId parameter is an identifier unique to each device. For that reason it is censored in regular APIs such as GET /devices/public or GET /devices/{serialNumber}.

The only way to acquire a device MachineId is by fetching the list of “private” devices (devices associated with your account).

If the serial number corresponds to a device that is currently associated with another account, these operations will fail. Similarly, the operations will fail if the device is currently with public status.

Was this article helpful?

Related Articles