Soracom Inventory
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.
-
Login to the User Console. From the Menu, open the Device Management screen. Ensure that you have selected the Global coverage type.
-
From the list of Inventory devices, click the for the device you want to access.
-
Click the Details button. Under the Basic Settings tab, you will see all device resources reported by the device agent.
For each resource, one or more of the following buttons will be available depending on the resource type:
- - Send a
read
request to the resource. The server will request the value from the agent. - - Send a
write
request to the resource. A dialog will appear allowing you to enter a new value for the resource. - - Send a
observe
request to the resource. The server will request the agent to send change notifications. When the value changes, the agent will send the new value to the server. Click again to send anunobserve
request. - - Send a
execute
request to the resource. The agent will execute a command on the device according to the resource configuration.
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