Accessing Resources

Once you have installed an agent on your device and it has successfully connected with the Inventory Device Management server, you will be able to view device resources directly from the User Console.

  1. Login to the User Console. From the Menu, open the Device Management screen. Ensure that you have selected the Global coverage type.

  2. From the list of Inventory devices, click the for the device you want to access.

    https://console.soracom.io

    View device details

  3. Click the Details button. Under the Basic Settings tab, you will see all device resources reported by the device agent.

    https://console.soracom.io

    Device details

For each resource, one or more of the following buttons will be available depending on the resource type:


Programmatic Usage

Because Soracom provides a power API, you can interact with object resources programmatically in a logical way.

Soracom API

Interacting with a device requires its device ID.

To read an object, simply use the readDeviceResource API method, providing the object, object instance, and resource numbers as URL paths:

curl -X GET \
>  -H 'Accept: application/json' \
>  https://g.api.soracom.io/v1/devices/<DEVICE-ID>/<OBJECT>/<INSTANCE>/<RESOURCE>

For example, when calling the API on /v1/devices/<DEVICE-ID>/3/0/0 (to read the manufacturer resource), Inventory will return something similar to this:

{
  "id": 0,
  "type": "STRING",
  "value": "Open Mobile Alliance"
}

You can also perform write, observe, unobserve, and execute actions from these APIs:

  • readDeviceResources - Read all resources within an object instance.
  • writeDeviceResource - Write a value to an object resource.
  • observeDeviceResource - Receive a notification when a resource value changes.
  • observeDeviceResources - Receive a notification when any values in an object instance change.
  • unobserveDeviceResource - Stop receiving notifications when a resource value changes.
  • unobserveDeviceResources - Stop receiving notifications when any values in an object instance change.
  • executeDeviceResource - Execute a command defined by an object resource.

Soracom CLI

You can interact similarly using the Soracom CLI:

soracom devices get-resource --device-id "<DEVICE-ID"> --object "<OBJECT>" --instance "<INSTANCE>" --resource "<RESOURCE>" --coverage-type g

Other actions are available with the following commands:

  • soracom devices put-resource
  • soracom devices observe-resource
  • soracom devices observe-resources
  • soracom devices unobserve-resource
  • soracom devices unobserve-resources
  • soracom devices execute-resource