Collecting assets
Contents
Introduction
One of the advantages offered by the Azban platform is the ability to easily collect data from any system and have it displayed directly in the Dashboard.
Each such unit of data is referred to as an asset.
Since assets are collected 'per-device', all of the examples presented here make use of the $DKEY environment variable to identify the device when calling the backend.
Collecting
Collecting assets is done by making HTTP requests to the 2bn.ch backend.
Two forms are available, one using GET and the other using POST.
Simple form (GET)
The simplest option is to make an HTTP GET request to:
https://2bn.ch/str/{DEVICE_ID}/{ASSET_DATA}
An example of this using curl is shown below:
# Collect asset 'hello world'
curl https://2bn.ch/str/$DKEY/hello+world
Advanced form (POST)
For more advanced use cases (involving more data), an HTTP POST request with an str form-parameter can be made to
https://2bn.ch/str/{DEVICE_ID}
Examples of this using curl are shown below:
# Collect asset 'hello world'
curl -F 'str=hello world' https://2bn.ch/str/$DKEY
# Collect asset from variable '$my_variable'
curl -F "str=$my_variable" https://2bn.ch/str/$DKEY
# Collect asset from output of 'whoami' command
whoami | curl -F 'str=<-' https://2bn.ch/str/$DKEY